I need to split a string that is "Kermit D.Frogge", so this is the code I used:
firstName = strTkn.nextToken();
middleInitial = strTkn.nextToken(".");
//changing the delimiters to a . because there is no space between D and Frogge
lastName = strTkn.nextToken(" ");
//changing delimiters back to a space
hourlyWage = Double.parseDouble(strTkn.nextToken());
However, the result is:
Kermit
D
.Frogge
How would i use string tokenizer and not keep the period?