Here's one that I wrote a while back:
void sqlite3_instr(sqlite3_context* pContext, int argc, sqlite3_value** argv)
{
const char *str1 = (const char *) sqlite3_value_text(argv[0]);
const char *str2 = (const char *) sqlite3_value_text(argv[1]);
char *p = strstr(str1, str2);
int nResult = 0;
if(p != NULL)
{
nResult = p - str1 + 1;
}
sqlite3_result_int(pContext, nResult);
}
You'll need to register it as an extension function on the database connection,
but it should do the job.
Kenneth Ballard
On September 10, 2012 at 9:21 AM "Sébastien Roux" <[email protected]>
wrote:
> Hi,
>
> I'm looking for the[in]famous sqlite "*instr"* function which doesn't exist
> (searched the web so far without success). Also searched for a
> "*position"*function, without success too!
>
> Any idea or help? I found some threads about custom functions but no
> tutorial nor deeper explanations!
>
> Many thanks.
>
> Sébastien Roux
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users