Ruby on Rails Discussions
how to convert string into int
rubyonrails-talk
Tom_Mornini1
(Tom Mornini)
January 3, 2007, 12:44pm
1
~/Desktop: irb irb(main):005:0> "1 2 3 4 5".scan(/\d+/).inject(0) { |sum,item| sum+item.to_i } => 15
Related topics
Topic
Replies
Views
Activity
Trouble converting string to int
rubyonrails-talk
1
84
April 1, 2008
cant covert array of string in integers
rubyonrails-talk
0
124
January 5, 2007
string array to integer array
rubyonrails-talk
3
243
July 18, 2012
Cannot convert string to integer error with arrays and hash
rubyonrails-talk
16
210
August 28, 2010
Amateur Programmer
rubyonrails-talk
2
90
September 8, 2008