String REPLACE function
String REPLACE function
От:
Joel Burton <jburton@scw.org>
Дата:
Is there a function for substring replacement?
There's translate(s, a, b), but that replaces all characters in a with
their corresponding character in b, eg.
replace ('this is a cat', 'cat', 'dog') => ghis is o dog
I'm looking for a function that matches the whole string and replaces it:
replace ('this is a cat', 'cat', 'dog') => this is a dog
I know I could write it in PL/PGSQL, but it seems that it would be very
inefficient. We're not using PL/perl or PL/tcl in this project, so I'd
rather not do it this way if it coulod be avoided.
Am I missing anything? Has anyone already solved this?
Thanks!
--
Joel Burton
Director of Information Systems, Support Center of Washington
Re: String REPLACE function
От:
Bruno Wolff III <bruno@wolff.to>
Дата:
On Thu, Mar 22, 2001 at 07:14:51AM -0500, Joel Burton wrote: > > Is there a function for substring replacement? [snip] > Am I missing anything? Has anyone already solved this? I asked a similar question about a month ago, and got someone to add doing sed like string replacement in a function on the todo list.