Re: proposal: support empty string as separator for string_to_array - Mailing list pgsql-hackers

From Merlin Moncure
Subject Re: proposal: support empty string as separator for string_to_array
Date
Msg-id b42b73150907250715u4534c7c1we83b5645ce72c111@mail.gmail.com
Whole thread Raw
In response to proposal: support empty string as separator for string_to_array  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: proposal: support empty string as separator for string_to_array  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: proposal: support empty string as separator for string_to_array  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
On Fri, Jul 24, 2009 at 11:40 PM, Pavel Stehule<pavel.stehule@gmail.com> wrote:
> Hello
>
> I have one idea, that should simplify string to char array
> transformation. The base is idea: between every char is empty string,
> so empty string is regular separator for string_to_array function.
> This behave is inversion of array_to_string function behave:
>
> postgres=# select array_to_string(array['a','b','c'],'');
>  array_to_string
> -----------------
>  abc
> (1 row)
>
> postgres=# select string_to_array('abc','');
>  string_to_array
> -----------------
>  {a,b,c}
> (1 row)

postgres=# select regexp_split_to_array('abc', '');regexp_split_to_array
-----------------------{a,b,c}
(1 row)

:-)

merlin


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Shouldn't psql -1 imply ON_ERROR_STOP?
Next
From: Pavel Stehule
Date:
Subject: Re: proposal: support empty string as separator for string_to_array