Re: rtrim - Mailing list pgsql-php

From ryanne cruz
Subject Re: rtrim
Date
Msg-id 1043217688.3e2e3d1880fb9@mail.up.edu.ph
Whole thread Raw
In response to rtrim  (ryanne cruz <ryanne.cruz@up.edu.ph>)
List pgsql-php
Thanks Jason.

but my data in that column varies. what i mean is that not all data ends in ",
USA". some ends in ", Italy" or ", England". if i understood your code right,
this only works when all my data ends with ", USA" or any country with 3
letters on it. anymore ideas?



Quoting Jason k Larson <jlarson@candlefire.org>:

> rtrim and ltrim are used to remove whitespaces.  I'm not certain why you
> are getting unpredictable behavior, but try this instead.
>
> $column = substr ($column, 0, strlen($column)-5); // 5 = ', USA'
>
> http://www.php.net/manual/en/function.substr.php
>
> HTH,
> Jason k Larson
>
>
> ryanne cruz wrote:
>
> >
> > hi list.
> >
> > if there's anyone here who's familiar with teh rtrim function, please
> > i need
> > help.
> >
> > i have a table that has a column in it that has data in this format:
> >
> > California, USA
> > Nevada, USA
> > .
> > .
> > .
> >
> > when i use rtrim to erase the ", USA" part, it only sometimes work. a
> > sample
> > result would be:
> >
> > California
> > Nevad
> >
> > my query statement is:
> > update table set name=rtrim(name,', USA');
> >
> > why is it that it only works sometimes?
>
>



pgsql-php by date:

Previous
From: ryanne cruz
Date:
Subject: rtrim
Next
From: ryanne cruz
Date:
Subject: empty