From: Tim Hunter Date: 2009-03-10T23:03:32+09:00 Subject: Re: fized size record from a string lucac81 wrote: > Hello, I'm new to Ruby, and I'm learning it with a project that also > involves rails... > I'm stuck with an apparently simple problem, I receive from a form a > String and I need to extend it to a fixed char number (it must be 16 > chars with eventual trailing spaces) Look at the String#% method: irb(main):003:0> "%-16s" % "123" => "123 " This won't work if the original string is longer than 16, though. In that case you just a copy of the original string. -- Posted via http://www.ruby-forum.com/.