• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Use of String Tokeniser to get data after second occurrence of "_"

 
pendse anagha
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,
Could someone point me to how I could get data that exists after the second
occurrence of the delimiter "_".

Here is what I have :


I always seem to get "lmn" when I want to return "b"

Also if I specify input string as "lmn_a" - would it be possible to return null or an empty string ?

Thanks ,
-anagha
 
Adam Vinueza
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're calling the nextToken method only once, which is why you get "lmn" instead of "b". Try something like this instead:
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic