Function ropey::str_utils::char_to_byte_idx

source ยท
pub fn char_to_byte_idx(text: &str, char_idx: usize) -> usize
Expand description

Converts from char-index to byte-index in a string slice.

Any past-the-end index will return the one-past-the-end byte index.

Runs in O(N) time.