This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I am facing a dilemma regarding my StringTokenizer. I have this line as input :
treasureisland adventure The movie is based blabla. More blabla the end.
I declare a default stringtokenizer for this string.(delimiter = spaces)
By reading the first 2 tokens, i read the moviename and the movie type. Is there a way to grab whats left of the string into movieDescr without having to read tokens while hasmoretokens? (since that might alter the formatting of the text, ie losing any spaces in the text)
I am facing a dilemma regarding my StringTokenizer. I have this line as input :
treasureisland adventure The movie is based blabla. More blabla the end.
I declare a default stringtokenizer for this string.(delimiter = spaces)
By reading the first 2 tokens, i read the moviename and the movie type. Is there a way to grab whats left of the string into movieDescr without having to read tokens while hasmoretokens? (since that might alter the formatting of the text, ie losing any spaces in the text)
The 2 is to handle the space between name and type and the space between type and remainder of line (which I presume you don't want at the start of the description.
Joanne
Mike Mass
Greenhorn
Joined: Aug 13, 2004
Posts: 12
posted
0
Hi Michael,
thanks for your input regarding my question, The solution you propose would fail if the data is entered by a human being, as in extra spaces and tabs.
Also, thank you Joanne for your input, but we would fall back in the problem i mentioned above to Michael, if the user enters extra spaces or a tab, it wouldnt work.