Dan Diebolt
2/5/2009 7:19:00 AM
[Note: parts of this message were removed to make it a legal post.]
I sort of got hung up on doing this with split. Using scan might be easier than split. However it is worth noting that when you are splitting on a pattern you can keep what the pattern matches in the results array by capturing with a set of ()s. Compare these two statements:
irb> 'a,b,c'.split(/(,)/)
=> ["a", ",", "b", ",", "c"]
irb> 'a,b,c'.split(/,/)
=> ["a", "b", "c"]