Jacob, Raymond A Jr wrote:
(speaking of strings...)

> Is there a way to pad the result with leading zeros

$ ri String#rjust

----------------------------------------------------------- String#rjust
      str.rjust(integer, padstr=' ')   => new_str
------------------------------------------------------------------------
      If _integer_ is greater than the length of _str_, returns a new
      +String+ of length _integer_ with _str_ right justified and padded
      with _padstr_; otherwise, returns _str_.

         "hello".rjust(4)            #=> "hello"
         "hello".rjust(20)           #=> "               hello"
         "hello".rjust(20, '1234')   #=> "123412341234123hello"

HTH
--