Skip to main content

utf8_byte_to_utf16_column

Function utf8_byte_to_utf16_column 

Source
pub fn utf8_byte_to_utf16_column(line: &str, byte: u32) -> u32
Expand description

UTF-8 byte offset → UTF-16 code-unit offset within line. byte is treated as a position within the line text; if it’s past the end the function returns the line’s full utf-16 length plus the over-shoot in bytes (a useful approximation for clamped callers, but production paths shouldn’t pass beyond line.len()).