This week's book giveaway is in the Artificial Intelligence forum.
We're giving away four copies of Pragmatic AI and have Noah Gift on-line!
See this thread for details.
Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

write .txt file  RSS feed

 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have an string like "one,two,three, four,five,six".
and am sending different strings like above one by one.
I wanna write each word in separate line and save it as .txt file.
the text file has to be
one
two
three
four
five
six
2nd string
seven
eight
nine
.
..

Please help me out.
Thanks
Jowsaki
[ February 06, 2003: Message edited by: Sham Jowsaki ]
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sham,
All you need is a BufferedWriter and a StringTokenizer and you're in business.
Try this:

After you compile and run this, just open up the file out.txt in the same directory and see if it meets your criteria.
Hope this helps,
Michael Morris
[ February 06, 2003: Message edited by: Michael Morris ]
 
Sham Jowsaki
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Michael Morris:
Hi Sham,
All you need is a BufferedWriter and a StringTokenizer and you're in business.
Try this:

After you compile and run this, just open up the file out.txt in the same directory and see if it meets your criteria.
Hope this helps,
Michael Morris
[ February 06, 2003: Message edited by: Michael Morris ]



Thanks Michael. It is working fine.
Jowsaki
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!