Here's a sample of my data:
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
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!