| От | 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?
|
| Список | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера