File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes How to tokenize a line based on delimiter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to tokenize a line based on delimiter "at"?" Watch "How to tokenize a line based on delimiter "at"?" New topic
Author

How to tokenize a line based on delimiter "at"?

Deepak Kumar
Ranch Hand

Joined: Nov 05, 2007
Posts: 62
Hi All,

line1--> HelloAult (Hitn: Delhi India(255)) at [06/26/2008 13:40:17.13]:
line2--> HelloAult (Hitn:96 @ 26c62) at [01/29/2008 10:50:11.26]:

how to tokenize line1 and line2 based on the delimiter "at"
such that I get two tokens each from line1 and line2 as below.If not whats's the better solution to get two tokens each from line1 and line2 ??

line1's first token--> HelloAult (Hitn: Delhi India(255))
line1's second token--> [06/26/2008 13:40:17.13]:

line2's first token--> HelloAult (Hitn:96 @ 26c62)
line2's second token--> [01/29/2008 10:50:11.26]:


Thanks & Regards,
Deepak


Thanks,
Deepak
vanlalhmangaiha khiangte
Ranch Hand

Joined: Sep 11, 2006
Posts: 170
You can use String.split method.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
Originally posted by vanlalhmangaiha khiangte:
You can use String.split method.
Agree. But it's probably worthwhile learning about regular expressions so as to know what you can use as an argument to String#split.
Alan Moore
Ranch Hand

Joined: May 06, 2004
Posts: 262
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to tokenize a line based on delimiter "at"?