Here's a sample of my data:
100643421~GB~ACTIVE~0~1~~true~5.0~1246132975801~~N
You'll see there are two instances of blank fields: immediately before the word 'true', and before the 'N'.
Using '~' as a tokenizer, my code works OK, extracting
100643421
GB
ACTIVE
0
1
but then, on the next invocation of nextToken(), I get the previous value (i.e. '1') returned.
A call to countTokens() gives a result of 9, not the 11 I would have expected.
The relevant parts of my code are as follows:
String aStr, workStr; StringTokenizer st1 = new StringTokenizer(workStr, "~"); long theID; String region; ... aStr = st1.nextToken(); theID = Long.parseLong(aStr); aStr = st1.nextToken(); region = aStr.trim();
Any suggestions will be greatly appreciated!

New Topic/Question
Reply




MultiQuote






|