SQLite unicode() Function

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

unicode() Syntax

Here is the syntax of the SQLite unicode() function:

unicode(text)

Parameters

text

Required. The character whose numeric code is to be returned. If there are more than one characters, unicode() returns the unicode code point of the first character.

unicode() Examples

If you want to return the unicode code point of the first character of a given text, use the following statement:

SELECT
    unicode('h'),
    unicode('hello');
unicode('h')  unicode('hello')
------------  ----------------
104           104

You can also return the Unicode code point of a character encoded in UTF8.

SELECT
    unicode('你'),
    unicode('你好');
unicode('你')  unicode('你好')
------------  -------------
20320         20320