Function script::textinput::len_of_first_n_code_units

source ยท
fn len_of_first_n_code_units(text: &str, n: UTF16CodeUnits) -> UTF8Bytes
Expand description

The length in bytes of the first n code units in a string when encoded in UTF-16.

If the string is fewer than n code units, returns the length of the whole string.