954,184 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

StringTokenizer, while loops and return statements

I have some questions on StringTokenizer.
I used it to break a string that has the format : "string1,string2,string3;string4,string5,string6"

first into the two strings:

"string1,string2,string3"
"string4,string5,string6"



and then:

" String a = string1"
"String b = string2"
"String c = string3"

Where a = string4 in the next loop, and = string7 and so on if the loop is continued.
I used two while loops as well as StringTokenizer to carry this out.

However, I am supposed to return one of the tokens (say, string1)
as a string. When I use a return statement "return string1" the loop ends and does not process the remaining tokens (by this I mean that string1 could represent a car name, and string4's position in the string also indicates that it is another car name. When I ask for the car name, it only returns the first one instead of all, to all me to compare them.

Help please?

If you want to see the actual code that I've done I'd prefer to PM it.

unitethenations
Newbie Poster
3 posts since Jul 2006
Reputation Points: 10
Solved Threads: 0
 

Give me the code to see.

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You