• Post Reply Bookmark Topic Watch Topic
  • New Topic

StringTokenizer  RSS feed

 
Jinny Morris
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know why StringTokenizer is no longer "preferred"? I have looked at the Split method, but can see no way to retrieve which one of a list of possible separators was used. StringTokenizer lets me retrieve the separators as tokens. I hope that StringTokenizer isn't going to be deprecated ...

Thanks!
 
Chris Corbyn
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
split() takes a regular expression. If you don't want to loose any tokens when you split() then use a zero-width assertion, or a series of them.

Split at all word boundaries...


There are loads of ways to tokenize the strng in a lossless fashion

If you're trying to do anything more than a basic split however then there's a pretty good chance you really do have to tokenize the string manually.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!