Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: OT:perl variable question

Re: OT:perl variable question

From: Greg Norris <spikey.mcmarbles_at_gmail.com>
Date: Tue, 23 Nov 2004 10:46:17 -0600
Message-ID: <d4beff360411230846473663ba@mail.gmail.com>


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-l
Received on Tue Nov 23 2004 - 13:30:48 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US