From: 7stud -- Date: 2012-09-07T14:26:22+09:00 Subject: Re: Doing math in Ruby >Yet, all that did was return the first number of the equation. === to_i(base=10) → integer Returns the result of interpreting leading characters in str as an integer base base (between 2 and 36). Extraneous characters past the end of a valid number are ignored. If there is not a valid number at the start of str, 0 is returned. === puts "1abc".to_i puts "abc1".to_i --output:-- 1 0 What you are trying to do is more complicated. You have to examine each character in the string and try to decide what it is: a number or an operator. -- Posted via http://www.ruby-forum.com/.