Extract 1st and 2nd tokens..
Posted on 2005-04-28
Let's assume that I have a string, like so:
String s = "123 A 456 B";
the String will always be in that format. I need to tokenize it, so that I have two Strings, one with "123 A" and the other with "456 B".
What's the best way to achieve this?
Is there a way to specify a delimiter (perhaps with String#split() or StringTokenizer) but specify for it to ignore certain delimiters?? :o\ If you see what I mean..?
Tokenize String; with delimiter as " "; but don't process the first and last delimiters.