从outlook导入email地址
2008-01-05 09:56:49 来源:WEB开发网核心提示:Outlook有一种email地址格式,采用逗号分隔开字段,从outlook导入email地址,扩展名叫CSV,例如:"姓名","称谓","单位名称","部门","职务","邮政地址","邮
Outlook有一种email地址格式,采用逗号分隔开字段,扩展名叫CSV。
例如:
"姓名","称谓","单位名称","部门","职务","邮政地址","邮政编码","电话","传真","统一编码","其他电话","单位其他","移动电话","呼机","主页","电子邮件","备注"
下面写个程序打开csv文件,每行读取只用第一个逗号前的字符串作为姓名,email地址匹配格式取第一个(位置无关)粗陋程序如下:
PRivate static final String repmail ="([\\w.-]+[@]{1}((\\w)+[.]){1,3}(\\w)+)";
private static final String repname =".+?,";
Pattern mailPattern = Pattern.compile(repmail );
Pattern namePattern = Pattern.compile(repname);
File file = new File("test.CSV");
FileInputStream is = new FileInputStream(file);
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String input = null;
ArrayList list = new ArrayList();
while((input = br.readLine())!=null){
Matcher matchermail = mailPattern.matcher(input);
Matcher matchername = namePattern.matcher(input);
String[] card = new String[2];
if(matchername.find()){
card[0] = matchername.group(0).replaceAll("\"","");
}
if(matchermail.find()){
card[1] = matchermail.group(0);
}
if(card[0]==null card[0].equals("") card[1]==null card[1].equals("")){
continue;
}
list.add(card);
}//输出 for(int i=0;i
}
- ››导入SQL Server备份的数据库方法
- ››导入Android项目后Eclipse报错
- ››导入txt文件到SQL SERVER 2008
- ››Outlook2010无法发送邮件,堆积在发件箱的解决方法...
- ››Outlook收发邮件后网络断开咋回事
- ››Outlook Express也加把锁保安全
- ››Outlook邮箱帐号的具体设置方法
- ››Outlook 2010 的十大优点描述
- ››Outlook社交连接器工具可访问MySpace
- ››Outlook 到 Google Calendar 到 Symbian Phone 全...
- ››Outlook 2010:优化IMAP功能
- ››Outlook通过RPC 访问Exchane邮箱以及如何把Exchan...
更多精彩
赞助商链接