the above code will give you the 10th token but my guess is you want it to be dynamic and not fixed to get the 10th token only. just make sure the number in "i<___" has to be one less than the value which you need. Let me know what happened. You can change the value in the for loop to get the desired value.
Life called,so here I am.<br />Cheers<br />Niki.:-)
Note that | is a special character in a regular expression and therefore needs to be escaped.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Seriously, this is a good exercise just for future reference even if your input will never be that messed up for this program. It can be solved with StringTokenizer, String.split or Scanner.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Try em and see! If you think you'll run into that kind of input, look at the other constructor for StringTokenizer and try that one, too.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
When it is used for evil, then watch out! When it is used for good, then things are much nicer. Like this tiny ad: