Re: Simple method to format a string?

Поиск
Список
Период
Сортировка
От Bosco Rama
Тема Re: Simple method to format a string?
Дата
Msg-id 4FE220D1.7070409@boscorama.com
обсуждение исходный текст
Ответ на Simple method to format a string?  (Emi Lu <emilu@encs.concordia.ca>)
Ответы Re: Simple method to format a string?  (Emi Lu <emilu@encs.concordia.ca>)
Список pgsql-general
Emi Lu wrote:
> Good morning,
>
> Is there a simply method in psql to format a string?
>
> For example, adding a space to every three consecutive letters:
>
> abcdefgh -> *** *** ***

Depending on how you want 'extras' handled, you could work from
something like this:

   select trim(regexp_replace('123456', '...', '\& ', 'g'));

If you don't care about trailing space remove the 'trim()'.

The replacement string may need to be escaped differently depending
on your PG version and setting for standard_conforming_strings.  For
example:  E'\\& '

HTH

Bosco.

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

Предыдущее
От: Edson Richter
Дата:
Сообщение: Re: efficiency of wildcards at both ends
Следующее
От: Thomas Kellerer
Дата:
Сообщение: Re: efficiency of wildcards at both ends