Reputation: 12395
I have input in this form
[email protected]
and\or in this form
[email protected];[email protected]
or
[email protected];[email protected];[email protected]
I should tokenize all, in a String array that contains only a single email for each cell without any separator
;
Upvotes: 2
Views: 430
Reputation: 40333
You don't want to tokenize, just use split
:
String[] emails = { "[email protected];[email protected];[email protected]", "[email protected]" };
List<string> result = new ArrayList<String>();
for ( string listOfEmails : emails ) {
for( string email : listOfEmails.split(";") ) {
result.Add(email).
}
}
System.out.println(result);
And it will work for all cases.
Upvotes: 3