If the result "[email protected]
" and I want to find the position of the @
symbol (3). Is it possible? It does not appear that SQLite has the equivalent of INSTR
, LOCATE
, POSITION
or any such function.
SELECT ?('[email protected]')
Update I ended up registering a custom extension function, but was surprised that I had to.
The substr() function extracts and returns a substring from string . The position of the substring is determined by index and its length is determined by count . If any parameter is NULL, a NULL will be returned. Otherwise, if string is not a BLOB it will be assumed to be a text value.
Description. SQLite instr() takes a string and a substring of it as arguments, and returns an integer which indicates the position of the first occurrence of the substring within the string.
SQLite substr() returns the specified number of characters from a particular position of a given string. A string from which a substring is to be returned. An integer indicating a string position within the string X. An integer indicating a number of characters to be returned.
Don't know whether this is a recent addition, but the INSTR
function will indeed find the 1st instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With