
On 2008-07-10 19:40 -0700 (Thu), Eric Torreborre wrote:
Neil's version of split is has the same kind of behavior than Java's, Ruby's, Python's where the separator is not included in the splitted list....
Actually, I seem to recall there was something in Ruby somewhere that did a split-type thing, but gave you the option of including the delimiter or not. But it's not in String#split, anyway. Ruby also has special behaviour for including or not including empty fields at the beginning or end. E.g.: "1,2,,3,4,,".split(',', 4) #=> ["1", "2", "", "3,4,,"] "1,2,,3,4,,".split(',', -4) #=> ["1", "2", "", "3", "4", "", ""]
I guess that should be possible to include a commonly used version of split in the standard libraries then, even if it is the "Haskell version" of split.
Or perhaps we could find some way of specifying how the split is
supposed to work.
cjs
--
Curt Sampson