$strLenCP (aggregation)
On this page
Definition
-
$strLenCP
-
New in version 3.4.
Returns the number of UTF-8 code points in the specified string.
$strLenCP
has the following operator expression syntax:The argument can be any valid expression as long as it resolves to an string. For more information on expressions, see Expressions.
If the argument resolves to a value of
null
or refers to a missing field,$strLenCP
returns an error.Example Results { $strLenCP: "abcde" }
5
{ $strLenCP: "Hello World!" }
12
{ $strLenCP: "cafeteria" }
9
{ $strLenCP: "cafétéria" }
9
{ $strLenCP: "" }
0
{ $strLenCP: "$€λA" }
4
{ $strLenCP: "寿司" }
2
Behavior
The $strLenCP
operator counts the number of code points in the specified string. This behavior differs from the $strLenBytes
operator which counts the number of bytes in the string, where each character uses between one and four bytes.