Darren Duncan <[email protected]> wrote: > RB Smissaert wrote: >> Does SQLite have a string function that produces the first position >> of a string within another string? >> For example select Instr('abcd', 'c') would produce 3 >> Looked in the documentation and the forum, but couldn't see it. > > This also isn't a simple problem since the answer would vary > depending on your abstraction level in dealing with characters; for > example, is a character a language-dependent grapheme, a > language-independent grapheme, a Unicode codepoint, a byte, an > integer, etc. If asked the length of a character string that has an > accented letter, say, the answer would vary depending on which of the > above abstractions they want the answer in, and for less abstracted > answers, it is affected by what codepoints or bytes are used for the > character, etc.
Well, there's substr() and length(), so some of these design choices have already been made. Obviously, if instr is implemented, it should be consistent with those. So that, if instr(a, b) == p, then substr(a, p, length(b)) == b. Igor Tandetnik _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

