• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regular expression

 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Split method

I want to know how the following 2 cases worked in the example mentioned in the above link


[ December 14, 2004: Message edited by: Pradeep Bhat ]
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


If the limit is negative, the actual value doesn't matter. The negative value just means to split into as many tokens as possible, and preserve any trailing empty tokens.



In this one, the first empty string is between the first two "o"s, the second empty string is between the other two "o"s, and that last empty string is there because the target ends with a delimiter, and the empty string is "after" that.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ernest for the great explanation.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic