Mr eel

Some Ruby Love

A single line of code to split a string into an array, then go through each entry and convert it into an integer.

date = string.split('-').collect {|entry| entry.to_i}

Something so complicated in another language turns out to be one line. *sob* I luv you Ruby!

Posted on August 3rd, 2005 | There are 0 comments

Comments

Add a comment

All contents © 2005—2007 Luke Matthew Sutton