From: Phrogz Date: 2010-07-24T13:00:06+09:00 Subject: Re: Text to Binary On Jul 22, 3:49 pm, Umm Whyshouldisay wrote: > However, I want each number to have 6 digits (6 trits in a tryte). How > would I do that? I want it to, if it didn't already have 6 digits in it, > add the appropriate number of zeros in the beginning of it. Anyone got > any suggestions here? >> numbers = [12, 120131, 0] => [12, 120131, 0] >> numbers.map{ |n| "%06d" % n } => ["000012", "120131", "000000"] See also http://ruby-doc.org/ruby-1.9/classes/Kernel.html#M002627