translate function

Started by Don V. Soledadalmost 23 years ago2 messagesgeneral
Jump to latest
#1Don V. Soledad
don.soledad@uratex.com.ph

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!

#2Steve Crawford
scrawford@pinpointresearch.com
In reply to: Don V. Soledad (#1)
Re: translate function

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

Show quoted text

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