From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
Cc: | Brian Dunavant <brian(at)omniti(dot)com>, Ron Ben <ronb910(at)walla(dot)co(dot)il>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Request to add feature to the Position function |
Date: | 2017-03-27 16:24:33 |
Message-ID: | CAKFQuwZs5WkhwFw=9BYQDesUr=NrrkoR=ESozk4FMgO+L204Eg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, Mar 27, 2017 at 9:16 AM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:
> On 03/27/2017 09:03 AM, Brian Dunavant wrote:
>
>> That does not return the correct answer for the original poster's request.
>>
>> flpg=# select position('om' in reverse('Tomomasaaaaaaaaaaa'));
>> position
>> ----------
>> 15
>> (1 row)
>>
>
> It shows the position counting back from the end. If you want counting
> from the front:
>
> aklaver(at)test=> select (length('Tomomasaaaaaaaaaaa')+ 1) - position('om'
> in reverse('Tomomasaaaaaaaaaaa'));
> ?column?
> ----------
> 4
>
>
Choosing a word containing an embedded palindrome is not recommended when
dealing with "reverse string" examples...
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2017-03-27 16:57:55 | Re: Request to add feature to the Position function |
Previous Message | Brian Dunavant | 2017-03-27 16:23:44 | Re: Request to add feature to the Position function |