aspose file tools
The moose likes Java in General and the fly likes Regular expression Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Regular expression" Watch "Regular expression" New topic

Regular expression

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8920

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

Joined: Jul 08, 2003
Posts: 24189

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.

[Jess in Action][AskingGoodQuestions]
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8920

Thanks Ernest for the great explanation.
I agree. Here's the link:
subject: Regular expression