I've make an own implementation and I want to contribute see the patch 
attached. 

Sintax: 
strpos(string, substring[, pos]); 

string -> the master string, can be any type (INTEGER, REAL, BLOB) 
substring -> to be searched, can be any type (INTEGER, REAL, BLOB) 
pos [optional default = 1] -> is the number of instance of substring in want, 
this value can be negative, negative values 
will be the search in reverse order like (strrchr) 

Return: 
The return is the index (1 based) of the char, or 0 if not found, or null if 
invalid parameters passed 

Exemples: 
dirname = substr(filename, 1, strpos(filename, "/", -1) - 1) 
basename = substr(filename, strpos(filename, "/", -1) + 1) 
strpos(123231, 2) == 2 
strpos(123231, 2, 1) == 2 
strpos(123231, 2, -1) == 4 
strpos(123231, 2, -2) == 2 
strpos(123231, 2, -3) == 0 


retrictions: pos need be different of zero 


----- Mensagem original ----- 
De: "Simon Slavin" <slav...@bigfraud.org> 
Para: "General Discussion of SQLite Database" <sqlite-users@sqlite.org> 
Enviadas: Quarta-feira, 17 de Março de 2010 11:05:04 
Assunto: Re: [sqlite] Why we don't have strpos function? 

Strings are 16-bit strings which may or may not be Unicode strings, I think. 
It's hard to work out the position in a string if you don't know what encoding 
you're using. 

Simon. 
_______________________________________________ 
sqlite-users mailing list 
sqlite-users@sqlite.org 
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users 


-- 

Atenciosamente, 

Israel Lins Albuquerque 
Desenvolvimento 
Polibrás Brasil Software Ltda. 


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to