File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes getting the words alone Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "getting the words alone" Watch "getting the words alone" New topic

getting the words alone

catherine matthews
Ranch Hand

Joined: Jan 22, 2006
Posts: 78
i was given this
when i post the same question
well... i am still confused... of how to use it....
what is a nval?
how do i intialize it?

well i tried... one of the examples from a website

I still do not know how to parse this line???
String str ="int one, two , three ,four , five,six,seven"
the words like five, six,seven happens as a single String... how do i parse them??
please help

[ July 15, 2006: Message edited by: catherine matthews ]
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
The notation "instream.nval" tells you nval is a member on instream, which was declared as a StreamTokenizer. The doc for StreamTokenizer says nval is ...

There are many ways to parse a string. You can look into StringTokenizer (actually don't ... Sun says don't use it in new programs any more), String.split(), and the whole world of regular expressions.

I haven't used StreamTokenizer but see if setting wordChars() and whitespaceChars() would help you break on commas.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: getting the words alone
It's not a secret anymore!