funkce strpos() - firebird 2.1

99 views
Skip to first unread message

votava

unread,
Oct 27, 2009, 4:26:18 AM10/27/09
to Firebird (CZ)
dobrý den,
poraďte, prosím, jak vytvořit funkci strpos() ve firebirdu,
s pozdravem Vot.

respektive

unread,
Oct 27, 2009, 5:17:53 AM10/27/09
to Firebird (CZ)
Ahoj obvykle pouzivam kombinaci StrLen a SubStrLen v cyklu While

zkus toto

create or alter procedure STRPOS (
ZDROJ STRING_512,
HLEDAT STRING_30)
returns (
POZICE SMALL_NOTNULL)
as
declare variable DELKA_TEXTU SMALL_NOTNULL;
declare variable DELKA_HLED SMALL_NOTNULL;
declare variable I SMALL_NOTNULL;
declare variable PODRETEZ STRING_30;
begin
delka_textu = strlen(zdroj);
delka_hled = strlen(hledat);
i = 1;
pozice = 0;

while ( (i + delka_hled) <= delka_textu ) do
begin

podretez = substrlen(zdroj, i, delka_hled);
if (podretez = hledat) then
begin

pozice = i;
suspend;
exit;

end

i = i + 1;

end
suspend;
end
^

Jiri Cincura

unread,
Oct 27, 2009, 5:46:11 AM10/27/09
to fireb...@googlegroups.com
2009/10/27 votava <ma...@votavasw.com>:
> strpos() ve firebirdu

Ve 2.1 je dostupna fce POSITION.

--
Jiri {x2} Cincura (CTO x2develop.com)
http://blog.cincura.net/ | http://www.ID3renamer.com

Reply all
Reply to author
Forward
0 new messages