OFF-TOPIC for SERVLET-INTEREST. Please direct your question to a more
appropriate resource.
newsgroup: comp.lang.java.programmer
mailing list: mail [EMAIL PROTECTED]
Java FAQ: http://java.sun.com/people/linden/faq_b2.html#I/O
API: http://java.sun.com/products/jdk/1.2/docs/api/index.html
The Java FAQ has one question about StreamTokenizer. The FQQ answer
doesn't directly answer your question, but you may see a clue in
examining how the sample code calls the whitespaceChars method. Then if
you had checked the API docs for StreamTokenizer you may have found an
answer by looking for the whitespaceChars method.
"Jenkins, Christopher" wrote:
>
> Hi,
>
> I've checked the archives and numerous help pages and Java in a Nutshell by
> Mr. D. Flanagan, could somebody please answer the following question:
>
> I've used the following code to tokenize the input from a file, however on
> of the entries has a space which should be split i.e. "Fred Jones" is
> currently read as "Fred" and "Jones", furthermore, the entrie are delimited
> by "," (COMMA) and EOL. It appears that I need to use wordChar() and
> whitespaceChar() respectively but I'm not sure how, mainly because of the
> unicode to int conversion required!
>
> Please help!
>
> StreamTokenizer tokenizer = new StreamTokenizer(in);
> int type;
> while ((type = tokenizer.nextToken()) != StreamTokenizer.TT_EOF)
> {
> switch (type)
> {
> case StreamTokenizer.TT_NUMBER:
> // out.println("<>Number: " + tokenizer.nval);
> break;
> case StreamTokenizer.TT_WORD:
> out.println(" <option>" + tokenizer.sval);
> break;
> }
> }
>
> out.println("</form>");
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html