Need Serious Help with method using StringTokenizer
Hello i need some serious help with a method using String Tokenizer.
I have a set of bookings saved in a string variable in the following order.
"day^time^customer^type". This is wat i have stored in my String variable:
"15^6^Jon Wright^regular
2^1^Mike Scott^supreme
7^2^Don Valley^regular"
ok i hope everyone got wat i wrote..i have another method where i check the parameters and see if those days have been booked or not. i need to use String Tokenizer to first remove '\n" and then again to remove "^". But i dont know how run a loop and check for all the 3 bookings. Here is my codings...i hope someone can help me....
publicboolean checktimings (int day,int time)throws IOException{
String book = getBookings();
String daytimecheck ="";
String piececheck ="";
String check2 ="";
StringTokenizer next;
StringTokenizer token =new StringTokenizer (book,"\n");
while (token.hasMoreTokens()){
daytimecheck = token.nextToken();
next =new StringTokenizer (daytimecheck,"^");
piececheck = next.nextToken();
check2 = next.nextToken();
}
int dayc = Integer.parseInt(piececheck);
int dayd = Integer.parseInt(check2);
if day == dayc && time == dayd{returntrue;}
else{returnfalse;}
}
i know this code doesn't work...can anyone help me..?

