From: Harry Kakueki Date: 2010-12-01T18:10:55+09:00 Subject: Re: A question about string#% On Wed, Dec 1, 2010 at 5:29 PM, jun yu wrote: > I have an integer number like 1111, How can I get a string like below > by  the string#% ? > > "11110000" > > I know   "%-8d" % 1111 can get "1111    ". > > > Thank you. > > Is String#% a requirement or just your first idea? num = 1111 p num.to_s.ljust(8,"0") #> "11110000" Harry