SQLite String Functions
This page organizes commonly used SQLite string functions that allow you to efficiently manipulate string data.
-
char
The SQLite char() function accepts a series of Unicode code point values as parameters and returns a string consisting of the characters corresponding to these parameters in the order of the parameters. -
format
Use SQLite format() to format strings and numbers in SQLite 3.38.0 and later. It is the renamed printf() SQL function; older versions use printf(). -
glob
The SQLite glob() function checks if a given string matches a given pattern. -
hex
The SQLite hex() function treats the parameter as a BLOB and returns a string representing the hexadecimal uppercase form of this BLOB. -
instr
Learn SQLite instr(X,Y) with runnable examples for 1-based matches, missing strings, empty patterns, NULL inputs, Unicode text and BLOB byte offsets. -
length
Learn SQLite length() for Unicode characters, BLOB bytes, NULL and empty strings, with runnable examples and an explanation of embedded NUL characters. -
like
The SQLite like() function checks if a given string matches a given pattern. -
lower
The SQLite lower() function converts the given string to lowercase and returns it. -
ltrim
The SQLiteltrim()function removes the longest string containing all the characters specified by the parameter (whitespace by default) from the start a string. -
printf
Use SQLite printf() to format strings and numbers with %s, %d, %f, and SQLite-specific quoting specifiers. It remains an alias for format(). -
quote
The SQLite quote() function takes arguments and return them as SQL literals. -
randomblob
The SQLite randomblob() function returns a blob consisting of a given number of pseudorandom bytes. -
replace
SQLite replace(X,Y,Z) replaces every occurrence of Y in X with Z. Learn how BINARY matching, empty search strings, and replacement-value conversion work. -
rtrim
The SQLitertrim()function removes the longest string containing all the characters specified by the parameter (whitespace by default) from the end of a string. -
substr
Learn SQLite substr(X,Y,Z) with runnable examples for 1-based positions, negative starts and lengths, NULL inputs, and the substring() alias. -
substring
SQLite substring() is an alias for substr() since SQLite 3.34.0. Learn 1-based positions, optional length, negative indexes and portability with tested examples. -
trim
The SQLitetrim()function removes the longest string containing all the characters specified by the parameter (whitespace by default) from the start and end of a string. -
unicode
The SQLiteunicode()function returns the Unicode code point of the first character of the specified string. -
upper
The SQLite upper() function converts the given string to uppercase and returns it. -
zeroblob
The SQLite zeroblob() function returns a blob containing the given number of bytes of0x00.