pub fn from_byte_idx(text: &str, byte_idx: usize) -> usize
Expand description
Converts from byte-index to utf16-code-unit-index in a string slice.
If the byte is in the middle of a multi-byte char, returns the utf16 index of the char that the byte belongs to.
Any past-the-end index will return the one-past-the-end utf16 index.
Runs in O(N) time.