• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Deepak Kumar
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
vanlalhmangaiha khiangte
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use String.split method.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49796
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 262
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic