Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
Does anyone now a simple and easy way to pad the end of a line with spaces (\s) so its a fixed size.
Example:
I have strings that look like this:
LR20SR37PD30LR23CR23BT01H
I need to have each string a fixed size of 40 chars
Example:
LR20SR37PD30LR23CR23BT01H\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s
Should I use sprintf, and a while loop, or is there an easier way??
Thanks!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Padding with \s
by davorg (Chancellor) on Sep 13, 2002 at 13:26 UTC | |
Re: Padding with \s
by busunsl (Vicar) on Sep 13, 2002 at 13:30 UTC | |
by bronto (Priest) on Sep 13, 2002 at 14:10 UTC | |
Re: Padding with \s
by Nemp (Pilgrim) on Sep 13, 2002 at 13:30 UTC | |
Re: Padding with \s
by jlongino (Parson) on Sep 13, 2002 at 14:05 UTC | |
Re: Padding with \s
by boo_radley (Parson) on Sep 13, 2002 at 13:39 UTC | |
Re: Padding with \s
by abitkin (Monk) on Sep 13, 2002 at 16:27 UTC |
Back to
Seekers of Perl Wisdom