Re: [GENERAL] Re: extra spaces
| From: | Denis A. Doroshenko | Date: | Wed, 20 Dec 2000 08:01:05 +0000 |
| Subject: | Re: [GENERAL] Re: extra spaces | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-5356@lists.php.net to get a copy of this message | ||
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] |_|| | || |||(/_|_