• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading a file  RSS feed

 
Padma Priya
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • 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" "Christine_Connors@intuit.com" "Laura Lerner" "Laura_Lerner@intuit.com" "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
 
Srivatsa Katta
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • 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
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Deepthi Tirunahari:

"Past Due 0 to 89 Days Ago 4/7/2007" "Christine Connors" "Christine_Connors@intuit.com" "Laura Lerner" "Laura_Lerner@intuit.com" "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 is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!