Skip to main content

char_to_byte_index

Function char_to_byte_index 

Source
pub fn char_to_byte_index(string: &str, char_index: usize) -> usize
Expand description

§Examples

use persistent_rope::char_to_byte_index;
assert_eq!(char_to_byte_index("長さ", 0), 0);
assert_eq!(char_to_byte_index("長さ", 1), 3);
assert_eq!(char_to_byte_index("長さ", 2), 6);