LENGTHUTF8()

Description

The lengthUTF8() function returns the length of the string str, measured in code points. A multibyte character counts as a single code point. This means that, for a string containing two 3-byte characters, LENGTH() returns 6, whereas LENGTHUTF8() returns 2.

Syntax

  1. > LENGTHUTF8(str)

Arguments

ArgumentsDescription
strRequired. String you want to calculate.

Examples

  1. > drop table if exists t1;
  2. > create table t1(a varchar(255),b varchar(255));
  3. > insert into t1 values('nihao','你好');
  4. > select lengthUTF8(a), lengthUTF8(b) from t1;
  5. +---------------+---------------+
  6. | lengthutf8(a) | lengthutf8(b) |
  7. +---------------+---------------+
  8. | 5 | 2 |
  9. +---------------+---------------+

Constraints

Currently, MatrixOne doesn’t support select function() without from tables.