Re: String reverse funtion?

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: String reverse funtion?
Дата
Msg-id CAFj8pRCu+mX3OcRmqev6Rpb3h6NjuJ=vbQ6+LtZAyxAhdCNpfg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: String reverse funtion?  (John Meyer <johnmeyer@pueblocomputing.com>)
Ответы Re: String reverse funtion?  (John Meyer <johnmeyer@pueblocomputing.com>)
Re: String reverse funtion?  (ginkgo36 <ginkgo56@gmail.com>)
Список pgsql-general



2013/10/9 John Meyer <johnmeyer@pueblocomputing.com>
On 10/9/2013 11:52 AM, David Johnston wrote:
ginkgo36 wrote
Hello everyone
  I have to reverse a string like EA;BX;CA to CA;BX;EA. or EA,BX,CA to
CA,BX,EA
  Is there any function to do this?

Thanks all!
No.  You will have to write your own.

David J.




Based upon the example, it's probably very easy to use a split/explode in your language of choice (VB.NET, perl, python, etc).

or SQL

select string_agg(u, ';' order by r desc)
   from (select row_number() over () r, u
                from unnest(string_to_array('EA;BX;CA',';')) u) x;
 string_agg
────────────
 CA;BX;EA
(1 row)

Regards

Pavel




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

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

Предыдущее
От: John Meyer
Дата:
Сообщение: Re: String reverse funtion?
Следующее
От: John Meyer
Дата:
Сообщение: Re: String reverse funtion?