Re: Re: extra spaces

From: "Denis A(dot) Doroshenko" <d(dot)doroshenko(at)omnitel(dot)net>
To: Mark Cowlishaw <markc(at)ot(dot)com(dot)au>
Cc: Alvaro Herrera <alvherre(at)protecne(dot)cl>, pgsql-general(at)postgresql(dot)org, php-db(at)lists(dot)php(dot)net
Subject: Re: Re: extra spaces
Date: 2000-12-20 08:01:05
Message-ID: 20001220100105.G32258@comrade.omnitel.lan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)doroshenko(at)omnitel(dot)net] |_|| | || |||(/_|_

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Johann Woeckinger 2000-12-20 09:06:22 More on: Character encoding problem using Tcl
Previous Message Karel Zak 2000-12-20 07:56:43 PL/Python (was: Re: [GENERAL] Re: [HACKERS] Trigger)