From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: reverse strpos? |
Date: | 2007-11-12 16:19:25 |
Message-ID: | 20071112161925.GA17422@a-kretschmer.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
am Mon, dem 12.11.2007, um 10:54:53 -0500 mailte Gauthier, Dave folgendes:
> Is there a function that?ll return the position of the last occurance of a char
> in a string?
>
>
>
> For Example, in the string ?abc/def/ghi? I want the position of the 2^nd ?/?.
write a function to revert the string and use strpos().
create or replace function rev(varchar) returns varchar as $$
declare
_temp varchar;
_count int;
begin
_temp := '';
for _count in reverse length($1)..1 loop
_temp := _temp || substring($1 from _count for 1);
end loop;
return _temp;
end;
$$ language plpgsql immutable;
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
From | Date | Subject | |
---|---|---|---|
Next Message | Erik Jones | 2007-11-12 16:25:13 | Re: Regression in 8.3? |
Previous Message | Tom Lane | 2007-11-12 16:18:49 | Re: Regression in 8.3? |