From: 7stud -- Date: 2011-09-15T02:01:27+09:00 Subject: Re: Integers to English Words. This: def to_words string_fragment= [] num = self if num >= 1_000_000 millions = num/1_000_000 string_fragment << "%s million" % hundreds_helper(millions) num -= millions*1_000_000 end if num >= 1_000 thousands = num/1_000 string_fragment << "%s thousand" % hundreds_helper(thousands) num -= thousands*1_000 end string_fragment << hundreds_helper(num) string_fragment.join(' ') end can be changed to: def to_words string_fragment= [] num = self if num >= 1_000_000 millions = num/1_000_000 string_fragment << "%s million" % hundreds_helper(millions) num -= millions*1_000_000 end if num >= 1_000 thousands = num/1_000 string_fragment << "%s thousand" % hundreds_helper(thousands) num -= thousands*1_000 end if num > 0 string_fragment << hundreds_helper(num) end string_fragment.join(' ') end -- Posted via http://www.ruby-forum.com/.