In the constructor of the tokeniser, you can speify if the delimiters become
tokens or not.
If all you want to do is split the string at each token, then use this
feature. If you are wanting the delimiter ragged onto the end of each token,
simply append it..
//Chop the string then put it back together!!!
StringBuffer buf = new StringBuffer();
StringTokenizer tok = new StringTokenizer("My|Token|String","|",false);
while(tok.hasMoreTokens()){
buf.append(tok.nextToken()).append("|");
}
System.out.println(tok.toString());
HTH
Steve
"Rene" <re**********@gmx.at> wrote in message
news:c2**************************@posting.google.c om...
Hi,
i'm a newbie at java and have a question for beginners.
So i'm try to create a type of parser for a input-string. i take a
StringTokenizer to cut the Sting into token. But i want, that the
seperator belongs to the token and not to the next token. is there a
chance to do this, or is there a better way to spilt a Strong?
Thanks,
Rene