Import Email Address from Outlook

zhaozj2021-02-11  169

Outlook has an email address format that uses a comma-separated field and expands CSV. For example: "Name", "title", "Unit Name", "Department", "Post Address", "Postal Codes", "Phone", "Fax", "Unified Coding", "Other Phones" , "Other", "Mobile Phone", "Brass", "Home", "Email", "Remarks" program opens the file, read only the string before the first comma is named, email address Matching format takes the first (location-independent) to write a rough program: 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 matcher = 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);} // Output for (int i = 0; i

转载请注明原文地址:https://www.9cbs.com/read-5783.html

New Post(0)