VeloDB Cloud
SQL Manual
Functions
string-functions
char_length

char_length

Description

Syntax:

INT char_length(VARCHAR str)

This function returns the length of the string. For multi-byte characters, it will return the number of characters. Currently, it only supports UTF8 encoding. character_length is the alias for this function.

Example

mysql> select char_length("abc");
+--------------------+
| char_length('abc') |
+--------------------+
|                  3 |
+--------------------+

mysql> select char_length("中国");
+------------------- ---+
| char_length('中国')   |
+-----------------------+
|                     2 |
+-----------------------+

Keywords

CHAR_LENGTH, CHARACTER_LENGTH