Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Java
Bug in String's split method???
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="castillo.bryan, post: 615925"] Yes I saw that part, but the part that throws me is the limit parameter. Here are the docs on that. Not the asterisks. The limit parameter controls the number of times the pattern is applied and therefore affects the length of the resulting array. If the limit n is greater than zero then the pattern will be applied at most n - 1 times, the array's length will be no greater than n, and the array's last entry will contain all input beyond the last matched delimiter. If n is non-positive then the pattern will be applied as many times as possible and the array can have any length. *If n is zero then the pattern will be applied as many times as possible, the array can have any length, and trailing empty strings will be discarded.* ------ I think that the poriton you emphasized "f the expression does not match any part of the input then the resulting array has just one element, namely this string." and the portion I emphasized "If n is zero then the pattern will be applied as many times as possible, the array can have any length, and trailing empty strings will be discarded." conflict with eachother in the case "".split(",", 0); The limit was zero so the empty trailing field should have been discarded. I could read the docs both ways. The docs are ambiguous on this feature. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Java
Bug in String's split method???
Top