Skip to main content

CHAR_LENGTH

Description​

Calculates the length of a string. For multi-byte characters, returns the number of characters.

Currently only supports utf8 encoding

Alias​

  • CHARACTER_LENGTH

Syntax​

CHAR_LENGTH ( <str> )

Parameters​

ParameterDescription
<str>The string to calculate the length of

Return value​

The length of the string .

Example​

select CHAR_LENGTH("abc"),CHAR_LENGTH("δΈ­ε›½")
+-------------------------+----------------------------+
| character_length('abc') | character_length('δΈ­ε›½') |
+-------------------------+----------------------------+
| 3 | 2 |
+-------------------------+----------------------------+