Use the substr
function.
From the list of core functions:
substr(X,Y,Z) substr(X,Y) substring(X,Y,Z) substring(X,Y)
The
substr(X,Y,Z)
function returns a substring of input stringX
that
begins with theY-th
character and which isZ
characters long. IfZ
is
omitted thensubstr(X,Y)
returns all characters through the end of the
stringX
beginning with theY-th
. The left-most character ofX
is
number 1. IfY
is negative then the first character of the substring
is found by counting from the right rather than the left. IfZ
is
negative then theabs(Z)
characters preceding theY-th
character are
returned. IfX
is a string then characters indices refer to actual
UTF-8 characters. IfX
is a BLOB then the indices refer to bytes.
substring()
is an alias forsubstr()
beginning with SQLite version
3.34.