permaculture playing cards*
The moose likes Java in General and the fly likes help with testing the last token Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "help with testing the last token" Watch "help with testing the last token" New topic
Author

help with testing the last token

ben riches
Ranch Hand

Joined: Nov 08, 2002
Posts: 126
hello everyone can someone help me please?
i want to be able to test the last token, to see if it is a delimeter or a string. if the last token is a delimeter (comma), i want an empty string to be put in my vector.
i already have tested to see if between two delimeters is a empty string or not and that works fine, but i am a bit stuck on how to see if the last token is a delimeter or not.
could someone please give me some ideas or solutions.
thanks
ben
Sayed Ibrahim Hashimi
Ranch Hand

Joined: May 17, 2001
Posts: 148
Originally posted by ben riches:
hello everyone can someone help me please?
i want to be able to test the last token, to see if it is a delimeter or a string. if the last token is a delimeter (comma), i want an empty string to be put in my vector.
i already have tested to see if between two delimeters is a empty string or not and that works fine, but i am a bit stuck on how to see if the last token is a delimeter or not.
could someone please give me some ideas or solutions.
thanks
ben

Can't you just hold a copy of the last token that you used and iterate through all the tokens and at the end your copy will point the last one so check to see if its a delimiter or a string.
Example:

Hope this helps.


SCJP 1.4<br /><a href="http://www.cise.ufl.edu/~sih" target="_blank" rel="nofollow">www.cise.ufl.edu/~sih</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help with testing the last token