Function str_indices::utf16::to_byte_idx
source · [−]Expand description
Converts from utf16-code-unit-index to byte-index in a string slice.
If the utf16 index is in the middle of a char, returns the bytes index of the char that utf16 code unit belongs to.
Any past-the-end index will return the one-past-the-end byte index.
Runs in O(N) time.