Re: Request to add feature to the Position function

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Request to add feature to the Position function
Дата
Msg-id CAKFQuwZs5WkhwFw=9BYQDesUr=NrrkoR=ESozk4FMgO+L204Eg@mail.gmail.com
обсуждение исходный текст
Ответ на Request to add feature to the Position function  (Ron Ben <ronb910@walla.co.il>)
Список pgsql-general
On Mon, Mar 27, 2017 at 9:16 AM, Adrian Klaver <adrian.klaver@aklaver.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@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.​

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

Предыдущее
От: Brian Dunavant
Дата:
Сообщение: Re: Request to add feature to the Position function
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Request to add feature to the Position function