Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Parse * delimited string

 
John Landon
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
What is the best way to parse * delimited string. I mean onto an array of strings or something.

Thanks.
 
Uli Hofstoetter
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anything wrong with String.split?
 
John Landon
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
noh tokenizer is the right thing. Thanks though
 
Campbell Ritchie
Sheriff
Pie
Posts: 49733
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, Tokenizer is legacy code. String#split is correct. Remember the * is a metacharacter and needs to be escaped.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic