您现在的位置是:首页
>
导入outlook文件夹 从outlook导入email地址
从outlook导入email地址 outlook有一种email地址格式 采用逗号分隔开字段 扩展名叫CSV 例如 姓名 称谓 单位名称 部门 职务 邮政地址 邮政编码 电话 传真 统

从outlook导入email地址
outlook有一种email地址格式 采用逗号分隔开字段 扩展名叫CSV 例如 姓名 称谓 单位名称 部门 职务 邮政地址 邮政编码 电话 传真 统一编码 其他电话 单位其他 移动电话 呼机 主页 电子邮件 备注 下面写个程序打开csv文件 每行读取只用第一个逗号前的字符串作为姓名 email地址匹配格式取第一个(位置无关)粗陋程序如下 private static final String repmail = ([\w ]+[@]{ }((\w)+[ ]){ }(\w)+) ; private static final String repname = +? ; Pattern mailPattern = pile(repmail ); Pattern namePattern = pile(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[ ]; if(matchername find()){ card[ ] = matchername group( ) replaceAll( ); } if(matchermail find()){ card[ ] = matchermail group( ); } if(card[ ]==null || card[ ] equals( ) || card[ ]==null || card[ ] equals( )){ continue; } list add(card); }//输出 for(int i= ;i System out println(((String[])list get(i))[ ] + : + ((String[])list get(i))[ ]); } lishixinzhi/Article/program/Java/JSP/201311/19751 很赞哦! (1030)