Using the split method in java to split "Smith, John (111) 123-4567"
to "John"
"Smith"
"111"
. I need to get rid of the comma and the parentheses. This is what I have so far but it doesn't split the strings.
// split data into tokens separated by spaces
tokens = data.split(" , \\s ( ) ");
first = tokens[1];
last = tokens[0];
area = tokens[2];
// display the tokens one per line
for(int k = 0; k < tokens.length; k++) {
System.out.print(tokens[1] + " " + tokens[0] + " " + tokens[2]);
}