944,155 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 2291
  • Java RSS
Jul 5th, 2006
0

StringTokenizer, while loops and return statements

Expand Post »
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:
Java Syntax (Toggle Plain Text)
  1. "string1,string2,string3"
  2. "string4,string5,string6"
and then:
Java Syntax (Toggle Plain Text)
  1. " String a = string1"
  2. "String b = string2"
  3. "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.
Last edited by unitethenations; Jul 5th, 2006 at 2:01 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
unitethenations is offline Offline
3 posts
since Jul 2006
Jul 5th, 2006
0

Re: StringTokenizer, while loops and return statements

Give me the code to see.
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Starting With Java
Next Thread in Java Forum Timeline: What the best version and download!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC