SQLite String Functions

This page organizes commonly used SQLite string functions that allow you to efficiently manipulate string data.

  1. 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.
  2. format

    The SQLite format() function formats a string according to the specified pattern, which is similar to the printf function.
  3. glob

    The SQLite glob() function checks if a given string matches a given pattern.
  4. hex

    The SQLite hex() function treats the parameter as a BLOB and returns a string representing the hexadecimal uppercase form of this BLOB.
  5. instr

    The SQLite instr() function finds the first occurrence of a given string within a given string, and returns a number (1-based) representing the position of the first occurrence if found, otherwise 0.
  6. length

    The SQLite length() function returns the number of characters in a given string, or return the number of bytes in a given blob value.
  7. like

    The SQLite like() function checks if a given string matches a given pattern.
  8. lower

    The SQLite lower() function converts the given string to lowercase and returns it.
  9. ltrim

    The SQLite ltrim() function removes the longest string containing all the characters specified by the parameter (whitespace by default) from the start a string.
  10. printf

    The SQLite printf() function formats a string according to the specified pattern, which is similar to the printf function in C.
  11. quote

    The SQLite quote() function takes arguments and return them as SQL literals.
  12. randomblob

    The SQLite randomblob() function returns a blob consisting of a given number of pseudorandom bytes.
  13. replace

    The SQLite replace() function replaces all occurrences of a specified substring in a specified string with a new substring and returns the result.
  14. rtrim

    The SQLite rtrim() function removes the longest string containing all the characters specified by the parameter (whitespace by default) from the end of a string.
  15. substr

    The SQLite substr() function extracts and returns a substring from a specified string according to the specified starting position and length.
  16. substring

    The SQLite substring() function extracts and returns a substring from a specified string according to the specified starting position and length.
  17. trim

    The SQLite trim() function removes the longest string containing all the characters specified by the parameter (whitespace by default) from the start and end of a string.
  18. unicode

    The SQLite unicode() function returns the Unicode code point of the first character of the specified string.
  19. upper

    The SQLite upper() function converts the given string to uppercase and returns it.
  20. zeroblob

    The SQLite zeroblob() function returns a blob containing the given number of bytes of 0x00.