Next: , Previous: , Up: string   [Contents] string.strlength

Method: out = strlength (obj)

String length in characters (actually, UTF-16 code units).

Gets the length of each string, counted in UTF-16 code units. In most cases, this is the same as the number of characters. The exception is for characters outside the Unicode Basic Multilingual Plane, which are represented with UTF-16 surrogate pairs, and thus will count as 2 characters each.

The reason this method counts UTF-16 code units, instead of Unicode code points (true characters), is for Matlab compatibility.

This is the string length method you probably want to use, not strlength_bytes.

Returns double array of the same size as obj. Returns NaNs for missing strings.

See also: string.strlength_bytes