Re: replace text function

Поиск
Список
Период
Сортировка
От Mike Mascari
Тема Re: replace text function
Дата
Msg-id 3DC9D9A1.8080008@mascari.com
обсуждение исходный текст
Ответ на Re: replace text function  (Darren Ferguson <darren@crystalballinc.com>)
Список pgsql-general
Darren Ferguson wrote:
> There is a function called TRANSLATE
>
> This will do the trick
>
> HTH

TRANSLATE performs a character-by-character replacement. You
cannot use TRANSLATE to substitute words or phrases. Example:

SELECT TRANSLATE('mikei', 'ike', '*8p');

m*8p*

all i's->*
all k's->8
all e's->p

You must either write your own replace(), or use the one
included in 7.3 as Joe Conway mentioned.

Mike Mascari
mascarm@mascari.com

>
> On Thu, 7 Nov 2002, Mark Wilson wrote:
>
>>Hi all,
>>
>>I'm trying to find a function that will replace one word with another in a
>>string.
>>
>>e.g. select <replace function>('bob was here, bobina wasnt', 'bob', 'mike');
>>will return "mike was here, mikeina wasnt"
>>
>>Is there such a function already written in PostGreSQL?


В списке pgsql-general по дате отправления:

Предыдущее
От: "Andrew Bartley"
Дата:
Сообщение: bit strings
Следующее
От: "Mark Wilson"
Дата:
Сообщение: Re: replace text function