Originally posted by Sean Ellis: ...Should be: String tokens = lineToParse.split("\\|");...
I'm glad you got it!
For anyone following, the String argument in String's split method is treated as a regex Pattern (see java.util.regex.Pattern). In this context, the pipe character has special meaning as a logical "or." To get a literal pipe in a String literal, you need the double escape sequence, \\|.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Joined: Aug 22, 2007
Thanks Marc! And thank you for the further explanation.