• Post Reply Bookmark Topic Watch Topic
  • New Topic

string seperation  RSS feed

 
supriya acharya
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a file... now i want to open it and read the data split the data. i cannot use StringTokenizer since i do not want the normal delimiters.... like ,*+ etc. i dont want to use String Tokenizer.
this is my file

91997869686** hello-160by2.com(Ad: Have a blog? Use 160by2.com widgets to let readers send free SMS)**"2009/02/05 14:58:36+22"***
9196379574954** hi sssp-160by2.com(Ad: Have a blog? Use 160by2.com widgets to let readers send free SMS)**"2009/02/05 14:58:52+22"***

now i want to extract the mobileno. * here is control z the symbol of control z has not appaered here but the records in the file are separated by control z not by *. ***(triple controlz) indicate start of next record...

can anyone tell me how do i read this file??? and separate the records

the output desired is:
91997869686
hello-160by2.com(Ad: Have a blog? Use 160by2.com widgets to let readers send free SMS)
2009/02/05 14:58:36+22"

can anyone tell me how to do this???
i cannot use String Tokenizer because this is an SMS that i am taking in file and so the sms can conatin +*& etc so i cannot set that as the delimiter..... otherwise i will lose the data....

 
Campbell Ritchie
Marshal
Posts: 56202
171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please choose the forum carefully; I think intermediate would have been more appropriate.

When you are splitting Strings (don't use StringTokenizer any more) you are usually best off using regular expressions.
 
supriya acharya
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thnks..i have used scanner..
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!