Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

split() questions - the two argument version

807580Aug 21 2010 — edited Aug 21 2010
Having read http://download-llnw.oracle.com/javase/6/docs/api/java/lang/String.html#split%28java.lang.String,%20int%29, I know that the second argument is used to limit the array's size. For example, if there 5 tokens and you put the number 4, then the last component of the array would have the two tokens including the delimiter. I also know that any negative number means infinity array size.

My questions are:_
*1)* Does the split() method with one argument implicitly have a negative number as the limit argument?
*2)* I read that 0 is the same as a negative number except that it also discards trailing empty strings. My problem is that I don't understand the examples nor can I visualize a situation in which there are no trailing empty strings. I need major elaboration (beyond the API's description) for the trailing empty strings situation so I would appreciate it if someone could give me that.

I think that's all I don't get so I'll finish my post off here.

Any input would be greatly appreciated!
Thanks in advance!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 18 2010
Added on Aug 21 2010
4 comments
214 views