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: Toper variable question

RE: Toper variable question

From: Reidy, Ron <Ron.Reidy_at_arraybiopharma.com>
Date: Wed, 24 Nov 2004 08:32:29 -0700
Message-ID: <17CAB0BF27BCFC47B0E4554A0E2F962B439115@fiji.arraybp.com>


Why reinvent the wheel?

perldoc -f sprintf



Ron Reidy
Lead DBA
Array BioPharma, Inc.

-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Gogala, Mladen Sent: Tuesday, November 23, 2004 2:05 PM To: 'spikey.mcmarbles_at_gmail.com'; ORACLE-L Subject: RE: Toper variable question

There is no need to write your own functions. There is a module which implements PHP functions. It's called PHP::Strings and one=20 of the functions that is implemented is str_pad. The most interesting=20 thing in the whole module is the fact that it is full of rant against=20 PHP by its authors, but they've chosen to implement PHP string functions in perl, nevertheless.

--
Mladen Gogala
Ext. 121
-----Original Message-----
From: Greg Norris [mailto:spikey.mcmarbles_at_gmail.com]=20
Sent: Tuesday, November 23, 2004 11:46 AM
To: ORACLE-L
Subject: 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 =3D &lpad($myvar, " ", 10);


On Tue, 23 Nov 2004 10:37:14 -0500, Michael McMullen
<ganstadba_at_hotmail.com> wrote:

>=20
>=20
> 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?
>=20
> Thanks > Mike > -- > http://www.freelists.org/webpage/oracle-l
>=20
--=20 "I'm too sexy for my code." - Awk Sed Fred. -- http://www.freelists.org/webpage/oracle-l -- http://www.freelists.org/webpage/oracle-l This electronic message transmission is a PRIVATE communication which = contains information which may be confidential or privileged. The information is = intended=20 to be for the use of the individual or entity named above. If you are = not the=20 intended recipient, please be aware that any disclosure, copying, = distribution=20 or use of the contents of this information is prohibited. Please notify = the sender of the delivery error by replying to this message, or notify us = by telephone (877-633-2436, ext. 0), and then delete it from your system. -- http://www.freelists.org/webpage/oracle-l
Received on Wed Nov 24 2004 - 09:27:03 CST

Original text of this message

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