
June 18th, 2003, 06:12 PM
|
|
Junior Member
|
|
Join Date: Apr 2003
Posts: 15
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
breaking up a string
What is the proper way to break up a string and get what you need out of it?
This is what I have...
I read a string in, say "blue 4 5".
What I want to be able to do is compare the first part of the string, blue, to blue. If they are equal, I need to read the last part, 4 5, in as a date. There is a lot more to this, but I am curious as to how to break up the string.
What I think I need to do is read the string in, blue 4 5.
Use a for loop to read the first 5 letters. Append those first 5 letters to a string, and compare that string to "blue ".
If they are equal, I use a for loop starting with index 6 and ending with 8, and read in the date. I then send that date to my queue.
Am I doing this right? Is there an easier way to break up the string?
Thanks for the help.
|