Skip to main content
Version: V1.2.0

CHAR_LENGTH

Syntax​

CHAR_LENGTH(str)

Description​

Returns the number of characters in the string str.

Each multi-byte character is counted as one character. For example, if the input string contains 5 two-byte characters, LENGTH() returns 10, and CHAR_LENGTH() returns 5.

Examples​

SELECT CHAR_LENGTH('China'), LENGTH('China'),CHAR_LENGTH('hello');
+-----------------------+------------------+----------------------+
| CHAR_LENGTH('China') | LENGTH('China') | CHAR_LENGTH('hello') |
+-----------------------+------------------+----------------------+
| 2 | 6 | 5 |
+-----------------------+------------------+----------------------+
1 row in set (0.001 sec)