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
Ruby
[rcr] String#split behaves odd
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="Simon Strandgaard, post: 4451705"] Maybe the return value of String#split is wrong. If I invoke split on an empty string, then it results in an empty Array (which I think is odd). ''.split(/\n/) #=> [] I would have expected this to happen: ''.split(/\n/) #=> [""] For instance JavaScript has a good split. alert("".split(/\n/).length); // -> 1 Also Python has good split. print "".split("\n"); # -> [''] However Perl has a bad split. $size = split(/\n/, ""); print "size is $size"; # -> 0 [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
[rcr] String#split behaves odd
Top