Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: OT:perl variable question
Here's a quick-n-dirty padding function I've used in the past.
sub lpad {
return($_[1] x ($_[2] - length($_[0])) . $_[0]); }
To pad a string with spaces to 10 characters, you'd invoke it like:
$myvar = &lpad($myvar, " ", 10);
On Tue, 23 Nov 2004 10:37:14 -0500, Michael McMullen
<ganstadba_at_hotmail.com> wrote:
>
>
> I'm trying to get the length of a variable and if the variable isn't a
> certain length pad it to the specified length.
> Can anyone help?
>
> Thanks
> Mike
> --
> http://www.freelists.org/webpage/oracle-l
>
-- "I'm too sexy for my code." - Awk Sed Fred. -- http://www.freelists.org/webpage/oracle-lReceived on Tue Nov 23 2004 - 13:30:48 CST
![]() |
![]() |