Re: Re: extra spaces - Mailing list pgsql-general

From Denis A. Doroshenko
Subject Re: Re: extra spaces
Date
Msg-id 20001220100105.G32258@comrade.omnitel.lan
Whole thread Raw
In response to Re: extra spaces  ("Mark Cowlishaw" <markc@ot.com.au>)
List pgsql-general
On Wed, Dec 20, 2000 at 10:35:01AM +1100, Mark Cowlishaw wrote:
> > According to "Postgres: Introduction and Concepts", varchar is slower
> > than char. So if you (like me) want to use char and get rid of the
> > padding spaces, you may use a regex replacement, as in
> >
> >         while (@row=$result->fetchrow)
> >             {
> >                 $row[0] =~ s/[\s]+$//;
> >             }
> >
> > in perl, or
> >
> > $array["name"]=preg_replace("'[\s]+$'", "", $array["name"], -1);
> >
> > in PHP.

i guess it would be better to use chop() (for trailing whitespaces) or
even trim() (strips whitespaces off begining as well)... it should be
considerably more effective then any regex...

--
Denis A. Doroshenko -- VAS/IN group engineer           .-.        _|_  |
[Omnitel Ltd., T.Sevcenkos st. 25, Vilnius, Lithuania] | | _ _  _ .| _ |
[Phone: +370 9863207 E-mail: d.doroshenko@omnitel.net] |_|| | || |||(/_|_

pgsql-general by date:

Previous
From: Karel Zak
Date:
Subject: PL/Python (was: Re: [GENERAL] Re: [HACKERS] Trigger)
Next
From: "Johann Woeckinger"
Date:
Subject: More on: Character encoding problem using Tcl