From: "Peña, Botp" Date: 2007-07-25T18:46:40+09:00 Subject: Re: Formatting text. From: Marcin Tyman [mailto:m.tyman@interia.pl] # Is there any way to format a string. I.E. I've got a variable # which may be 1, 2, 3 and the variable is added to string. I want # to show whole string formatted as follows: # 100 # 1 # 10 # 1100 it would be nice to show original string and it's transformation, but anyway, is it like this? irb(main):092:0> "1 20 333 1000 55".split.each{|x| puts x.rjust(4)} 1 20 333 1000 55 this is just using #rjust. irb(main):093:0> system "qri 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" => true irb(main):094:0> robert already gave a handful of other hints. kind regards -botp