Thursday, September 29, 2011

Ruby: String#split on empty pattern or string

RDoc Documentation [ruby-doc.org]

"Funny" feature, actually only for wierdos:


If pattern is a Regexpstr is divided where the pattern matches. Whenever the pattern matches a zero-length string, str is split into individual characters. If pattern contains groups, the respective matches will be returned in the array as well.

No comments: