David Alan Black <dblack / candle.superlink.net> writes: | Input: 123456 | Output: "one-hundred twenty-three thousand four-hundred fifty-six" I don't like hyphens, but it would be easy enough to put them in: def english_num (num) ones_names = '.one.two.three.four.five.six.seven.eight.nine.ten.eleven.twelve.thirteen.fourteen.fifteen.sixteen.seventeen.eighteen.nineteen'.split('.') tens_names = '.ten.twenty.thirty.forty.fifty.sixty.seventy.eighty.ninety'.split('.') ['', 'thousand', 'million', 'billion', 'trillion'].map { |gstr| (num, group) = num.divmod (1000) str = "" if group > 0 (hundreds, rest) = group.divmod (100) str << "#{ones_names[hundreds]} hundred " if hundreds > 0 if rest < 20 str << ones_names[rest] else (tens, ones) = rest.divmod(10) str << "#{tens_names[tens]} #{ones_names[ones]}" end str << " #{gstr}" end str }.reverse.join(' ').squeeze(' ').strip end print english_num (ARGV[0].to_i), "\n" -- http://www.dfan.org