Skip site navigation (1) Skip section navigation (2)

Re: proposal: support empty string as separator for string_to_array

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: support empty string as separator for string_to_array
Date: 2009-07-25 14:15:02
Message-ID: b42b73150907250715u4534c7c1we83b5645ce72c111@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Fri, Jul 24, 2009 at 11:40 PM, Pavel Stehule<pavel(dot)stehule(at)gmail(dot)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

In response to

Responses

pgsql-hackers by date

Next:From: Pavel StehuleDate: 2009-07-25 14:30:37
Subject: Re: proposal: support empty string as separator for string_to_array
Previous:From: Robert HaasDate: 2009-07-25 13:15:39
Subject: Re: Shouldn't psql -1 imply ON_ERROR_STOP?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group