• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getting the words alone

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic