Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

help with testing the last token

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
reply
    Bookmark Topic Watch Topic
  • New Topic