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
[bug] String#split wipes result
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="ts, post: 4431826"] S> irb(main):002:0> "abcde".split(/./) S> => [] S> Why is the second result empty? svg% ri String#split ----------------------------------------------------------- String#split str.split(pattern=$;, [limit]) => anArray ------------------------------------------------------------------------ [...] If the _limit_ parameter is omitted, trailing null fields are ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^n¤ supressed. If _limit_ is a positive number, at most that number of ^^^^^^^^^ fields will be returned (if _limit_ is +1+, the entire string is returned as the only entry in an array). If negative, there is no limit to the number of fields returned, and trailing null fields are not supressed. [...] svg% you have only null fields in the result Guy Decoux [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
[bug] String#split wipes result
Top