Showing posts with label ruby string array to integer array in ruby on rails. Show all posts
Showing posts with label ruby string array to integer array in ruby on rails. Show all posts

Saturday, July 31, 2010

Ruby string array converted into integer array


["1","2","3","4"].map(&:to_i) => [1, 2, 3, 4]
    OR
["1","2","3","4"].collect(&:to_i) => [1, 2, 3, 4]