• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Reading a file

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Everyone


In a text file i have the following text in one single line

"Past Due 0 to 89 Days Ago 4/7/2007" "Christine Connors" "[email protected]" "Laura Lerner" "[email protected]" "1385 - Workplace Harassment Prevention for Leaders (Online)"

I want to read only the names and the email id ommiting the "Past Due 0 to 89 Days Ago 4/7/2007" part.

Can anyone guide me in the problem

Thanks in advance
Deepthi
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Deepthi,

Read the complete line in to a string and then spit it using a regular expression.

Assuming <DOUBLE_QUOTE><SPACE><DOUBLE_QUOTE> as the delimiter between two fields, you can use something like this to get the email_id or any other field for that matter.



-Srivatsa Katta
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Deepthi Tirunahari:

"Past Due 0 to 89 Days Ago 4/7/2007" "Christine Connors" "[email protected]" "Laura Lerner" "[email protected]" "1385 - Workplace Harassment Prevention for Leaders (Online)"



Can you explain the format in more detail.
You can use a stream tokenized to getting token out of fileinputstream and then according to the format in which it has been stored , you can retrieve the name and e-mail id.
 
It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic