• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading a text file records separated by a ';'  RSS feed

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,



Just got stuck ,how to read a text file which has addresses separated by ';' and store the content in another text file

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read the lines from the text file and parse each line using String.split(";") to separate each token
 
Marshal
Posts: 56610
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.
An alternative would be to use a Scanner with ";" as its delimiter. Obviously if there are any semicolons in the wrong place the file will behave as a corrupted file.
 
shield kumar
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Welcome to JavaRanch.
An alternative would be to use a Scanner with ";" as its delimiter. Obviously if there are any semicolons in the wrong place the file will behave as a corrupted file.


i never used this Scanner can you write simple sample code that will read the address from a text file separated by ";"
 
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
punit pandia wrote:i never used this Scanner can you write simple sample code that will read the address from a text file separated by ";"


Why don't you try it yourself first, and see if it works. If not, post your code, explain exactly what it does, and we can help you fix it.

The best way to learn it to try it yourself.
 
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you can, have a look at the API documentation, give it a go and come back with any questions you might have!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!