Search Postgresql Archives

Re: Making substrings uppercase

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux