Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting the words alone

 
catherine matthews
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i was given this
example
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
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic