Java Email Validate getEmailListStr(String tempStr)

Here you can find the source of getEmailListStr(String tempStr)

Description

get Email List Str

License

Open Source License

Declaration

private static String getEmailListStr(String tempStr) 

Method Source Code

//package com.java2s;

import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    private static String getEmailListStr(String tempStr) {
        List<String> list = new ArrayList<String>();
        String regex = "[^a-zA-Z-]To: (.+)";
        Pattern ptn = Pattern.compile(regex);
        Matcher mc = null;//from w  w w .  j a  v a  2 s  . c  o m
        mc = ptn.matcher(tempStr);
        String temp = null;
        System.out.println("\n\n------------------------------------");
        while (mc.find()) {
            temp = mc.group(1);
            if (!list.contains(temp)) {
                System.out.println(temp);
                list.add(temp);
            }
        }
        if (list == null || list.size() == 0) {
            return null;
        }
        StringBuffer sbf = new StringBuffer();
        sbf.append(list.get(0));
        for (int i = 1; i < list.size(); i++) {
            sbf.append("','");
            sbf.append(list.get(i));
        }
        sbf.insert(0, "'");
        sbf.append("'");
        return sbf.toString();
    }
}

Related

  1. extractEmail(String string, StringBuffer sb)
  2. extractEmailAddresses(final String text)
  3. format(String emails)
  4. getEmail(String author)
  5. getEmailAddressFromDN(String dn)
  6. getEmails(String str)
  7. getFirstEmailAddr(String s)
  8. getSafeMailAddr(String mailAddr)
  9. getSmtpPort(String email)