Re: Re: extra spaces

Поиск
Список
Период
Сортировка
От Denis A. Doroshenko
Тема Re: Re: extra spaces
Дата
Msg-id 20001220100105.G32258@comrade.omnitel.lan
обсуждение исходный текст
Ответ на Re: extra spaces  ("Mark Cowlishaw" <markc@ot.com.au>)
Список 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 по дате отправления: