Hi, I have a program were I have a string of tokens. I need to determine which tokens are words and which are number. I don't know the method to do this. If there a parseFloat or a parseWord or parseChar of somekind that I could use? Here is the code, hopefully this explains what I'm going for better than how I explained it. Also I know they are all Ints but i need it to work for floating point also.
Thanksimport java.io.*; import java.util.*; public class theLoop { public static void main(String[] args) { String newStr = "Bob 45 34 29 1 87 total 789 total Bob 98 34 23 23 fred 50 50 50 40 total 190"; //Create new String tokenizer StringTokenizer StrTok = new StringTokenizer(newStr); //Set State to 1 int State = 1; //Set Loop to run while there are more tokens while(StrTok.hasMoreTokens) { //Make new String for tokens String S = StrTok.nextToken(); //Loop for first state if (State == 1) { if (S = //??? a word ???) { //Keep the word????, and proceed to next step State = 2; } } //Loop for second state if (State == 2) { if (S = //??? a word ???) { //?? Add word to previous word ?? State = 2; } else if (State = //?? a floating-point //??) { System.out.println(//the name from before); //?? Remember number State = 3; } } //and so on