Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using a string rather than single character as a delimeter in StringTokenizer?  RSS feed

 
Harold Barnes
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to use a string rather than single character as a delimeter in StringTokenizer? For example, I want to use "<phrase>" as my delimeter, but the StringTokenizer sees this as seperate <,p,h,r,a,s,e,> delimeters, not as a single delimeter.
 
Ray Stojonic
Ranch Hand
Posts: 326
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, the delim arg to StringTokenizer is a list of delimiting characters.

You can get the result you're looking for from String.split()
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!