Re: Making substrings uppercase

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Making substrings uppercase
Дата
Msg-id 20130909200352.GD6068@eldon.alvh.no-ip.org
обсуждение исходный текст
Ответ на Making substrings uppercase  (Oliver Kohll - Mailing Lists <oliver.lists@gtwm.co.uk>)
Ответы Re: Making substrings uppercase  (Oliver Kohll - Mailing Lists <oliver.lists@gtwm.co.uk>)
Список pgsql-general
Oliver Kohll - Mailing Lists wrote:
> Hello,
>
> Given a string with certain words surrounded by stars, e.g.
>
> The *quick* *brown* fox jumped over the *lazy* dog
>
> can you transform the words surrounded by stars with uppercase versions, i.e.

Maybe you can turn that into a resultset, then uppercase individual
words, then join them back into a string.  Something like

select string_agg(case when words like '*%*' then upper(btrim(words, '*')) else words end, ' ')
from regexp_split_to_table('The *quick* *brown* fox jumped over the *lazy* dog', ' ') as words;

                  string_agg
----------------------------------------------
 The QUICK BROWN fox jumped over the LAZY dog
(1 fila)

This is a bit simplistic, but hopefully you get the idea.

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


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

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: Call for design: PostgreSQL mugs
Следующее
От: "Mahlon E. Smith"
Дата:
Сообщение: Re: Streaming replication slave crash