str_indices::utf16

Function count_surrogates

Source
pub fn count_surrogates(text: &str) -> usize
Expand description

Counts the utf16 surrogate pairs that would be in a string slice if it were encoded as utf16.

Runs in O(N) time.