Re: Trim not working (PostgreSQL 9.1.2 on Win64)

Поиск
Список
Период
Сортировка
От Edson Richter
Тема Re: Trim not working (PostgreSQL 9.1.2 on Win64)
Дата
Msg-id BLU0-SMTP110B84789956C01E0C49844CFC00@phx.gbl
обсуждение исходный текст
Ответ на Trim not working (PostgreSQL 9.1.2 on Win64)  (Edson Richter <edsonrichter@hotmail.com>)
Список pgsql-general
Em 27/07/2012 21:04, Edson Richter escreveu:
> I've a select with the following expression:
>
> select trim(both ' ' from substring(rslinha2 from 5 for position('(-)'
> in rslinha2)-6))
>            from ...
>
> problem is that the spaces are not being removed from either side.
> What would be wrong?
>
> Thanks for your help,
>
> Edson Richter
>
>

Ok, sorry for answering my self. I just created an "alltrim" function
with the following code:

CREATE OR REPLACE FUNCTION alltrim(text)
   RETURNS text AS
$BODY$
select regexp_replace(regexp_replace($1, '^\s*', ''), '\s*$', '');

$BODY$
   LANGUAGE sql VOLATILE
   COST 100;


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

Предыдущее
От: Bborie Park
Дата:
Сообщение: Elegant method of accessing N-dimension array in C function
Следующее
От: Edson Richter
Дата:
Сообщение: Trim not working (PostgreSQL 9.1.2 on Win64)