This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
hi i have this problem... i am using the StreamTokenizer to read one word at a time... however, when i read words like 3G.. the StreamTokenizer will break up the 3 and G and read them seperately.. how do i solve this prob ? the code is as follows : while (innerReader.ttype != StreamTokenizer.TT_EOF) { if (innerReader.ttype == StreamTokenizer.TT_WORD) { record = innerReader.sval; record = record.toLowerCase(); } else if (innerReader.ttype == StreamTokenizer.TT_NUMBER) { record=innerReader.nval; } System.out.println(record); innerReader.nextToken(); }
Hi Roy - I haven't used the StreamTokenizer before, but the docs do say it reads a byte at a time; therein lies your problem. To get the behavior you want, you'll probably have to read in a line at a time, and use the java.io.StringTokenizer class to parse it. ------------------ Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
Make visible what, without you, might perhaps never have been seen. - Robert Bresson