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: 615810"] I was trying to write a utility method that work almost the same as the split method on String, that would work with java versions 1.3 or less, using Jakarta's ORO library. I though I implemented it according to the javadoc for the split method on String. But the expression "".split(",", 0), returns an array with 1 element, I was expecting an array with no elements. The expression ",".split(",", 0) returns an array with no elements. Is this a bug or am I reading the docs wrong? Code: String[] result = null; result = "".split(",", 0); System.out.println(result.length); result = ",".split(",", 0); System.out.println(result.length); System.out.println(System.getProperty("java.version")); Output: 1 0 1.4.2_06 I thing the output should be: 0 0 1.4.2_06 [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Java
Bug in String's split method???
Top