Skip to main content

byte_of_index

Function byte_of_index 

Source
pub fn byte_of_index(s: &str, idx: U16Index) -> usize
Expand description

The UTF-8 byte offset corresponding to a UTF-16 index into s. An index that falls inside a surrogate pair rounds down to the start of that code point, so the result is always a valid str boundary.