Обсуждение: translate function

Поиск
Список
Период
Сортировка

translate function

От
"Don V. Soledad"
Дата:
good day!

how could i use the function translate to output the replacement of the
exact occurrence of the 2nd parameter?

for instance,
    select translate('Juan dela Cruz C/O ABC Co.','C/O','c/o');
gives
             translate
    ----------------------------
     Juan dela cruz c/o ABc co.

i would like the output to be "Juan dela Cruz c/o ABC Co." instead of "Juan
dela cruz c/o ABc co." could i do this with the above function, or are
there any functions that could do this?

thank you very much!


Re: translate function

От
Steve Crawford
Дата:
In 7.3.x:

select replace('Juan dela Cruz C/O ABC Co.'::text,'C/O'::text,'c/o'::text);
          replace
----------------------------
 Juan dela Cruz c/o ABC Co.
(1 row)

Cheers,
Steve

On Thursday 01 May 2003 8:46 pm, Don V. Soledad wrote:
> good day!
>
> how could i use the function translate to output the replacement of the
> exact occurrence of the 2nd parameter?
>
> for instance,
>     select translate('Juan dela Cruz C/O ABC Co.','C/O','c/o');
> gives
>              translate
>     ----------------------------
>      Juan dela cruz c/o ABc co.
>
> i would like the output to be "Juan dela Cruz c/o ABC Co." instead of "Juan
> dela cruz c/o ABc co." could i do this with the above function, or are
> there any functions that could do this?
>
> thank you very much!
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org