Forgot to reply to list. Sorry. Perhaps somebody here knows of an "array_reverse" type function.
--
---------- Forwarded message ----------
From: John McKown <john.archie.mckown@xxxxxxxxx>
Date: Fri, Oct 11, 2013 at 7:53 AM
Subject: Re: String reverse funtion?
To: ginkgo36 <ginkgo56@xxxxxxxxx>
This would split the string into an array, where each element is delimited with a semi-colon - regexp_split_to_array
Reverse the order of the array with the __missing__ array_reverse function.
Combine back into a string with array_to_string.
But, given the lack of "array_reverse" or something equivalent, I guess you need to "roll your own" function.
--
From: John McKown <john.archie.mckown@xxxxxxxxx>
Date: Fri, Oct 11, 2013 at 7:53 AM
Subject: Re: String reverse funtion?
To: ginkgo36 <ginkgo56@xxxxxxxxx>
I don't see one. Looks like you will need to write your own function. I got close with a kludge. But I cannot find a base function which will "reverse" the order of elements in an array. If there were such a one, which I will call "array_reverse" in the example, then you could do:
select array_to_string( array_reverse( regexp_split_to_array(string_delimited_with_semicolons,';') ),';');On Wed, Oct 9, 2013 at 10:59 AM, ginkgo36 <ginkgo56@xxxxxxxxx> 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!
--
View this message in context: http://postgresql.1045698.n5.nabble.com/String-reverse-funtion-tp5773871.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
This is clearly another case of too many mad scientists, and not enough
hunchbacks.
Maranatha! <><
John McKown
John McKown
--
This is clearly another case of too many mad scientists, and not enough
hunchbacks.
Maranatha! <><
John McKown
John McKown