Files
doris/docs/en/sql-reference/sql-functions/string-functions/char_length.md
yangzhg 94b3a2bd50 [Bug] Fix string functions not support multibyte string (#3345)
Let string functions support utf8 encoding
2020-05-08 12:52:46 +08:00

1.4 KiB

title, language
title language
CHAR_LENGTH en

char_length

Description

Syntax

'INT char_length (VARCHAR str)'

Returns the length of the string and the number of characters returned for multi-byte characters. For example, five two-byte width words return a length of 5, only utf8 encodeing is support at current version.

example

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

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

keyword

CHAR_LENGTH