aspose file tools*
The moose likes Beginning Java and the fly likes Token Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Token" Watch "Token" New topic
Author

Token

Karen Baog
Ranch Hand

Joined: Mar 02, 2005
Posts: 120
Hi all,

I want to be able to split a string, for example;

Hello there\\end1 my dear\\end2

into...


Hello there
my dear

Basically, the tokens are \\end1 and \\end2.

I've looked at the StringTokenizer and split, but the delimiter is, even though a string, treats every character in the string a a delimiter. If I use "\\" as the argument, then it will also print the "end1" and "end2".


amerzil co-ed student<br />"Praise be the Code"
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

Have you tried using a regex (regular expression) based search and replace to replace all the "\\endn" instances with a newline character? That would probably be the way to go.

If you are not familiar with regex, there's a great information site, Regular-Expressions.info, that has tutorials, as well as specifics on using Regular Expressions in Java. There is also a Sun Tutorial on Regular Expressions in Java.
 
Don't get me started about those stupid light bulbs.
 
subject: Token