Skip to main content

CHAR_LENGTH

Returns the length of the string str, measured in characters. A multibyte character counts as a single character. This means that for a string containing five 2-byte characters, LENGTH() returns 10, whereas CHAR_LENGTH() returns 5.

Syntax

CHAR_LENGTH(str);

Arguments

ArgumentsDescription
strThe string

Return Type

Numeric data type value.

Examples

SELECT CHAR_LENGTH('hello');
+----------------------+
| CHAR_LENGTH('hello') |
+----------------------+
| 5 |
+----------------------+