From: Tomas Brixi Date: 2001-10-31T22:49:56+09:00 Subject: [ruby-talk:23947] Re: strange string formating Today it's a _BAD_ day ;-) I have solved it meanwhile Sorry for flooding mailist with such a stupid question Tom ts wrote: >>>>>>"T" == Tomas Brixi writes: >>>>>> > >T> TK1000000104 0055.25 > 1234567 > >T> out = format( "%13s%04.2f", parts[0], part[1].to_f ) > > With "%04.2f" 4 give the length of the field, in your example you probably > want a field length of 7, i.e. > >pigeon% /usr/bin/ruby -e 'puts format("%04.2f", 55.25)' >55.25 >pigeon% > >pigeon% /usr/bin/ruby -e 'puts format("%07.2f", 55.25)' >0055.25 >pigeon% > > > >Guy Decoux > > > > > >