Skip to main content

Module utf8_offsets

Module utf8_offsets 

Source
Expand description

UTF-8 byte offset to character offset conversion utilities.

JavaScript uses UTF-16 code units for string indexing, while Rust uses bytes. This module provides functions to convert between byte offsets and character offsets for proper interoperability with JavaScript/WASM environments.

Functionsยง

byte_column_to_char_column
Convert a byte offset to a character offset in a UTF-8 string.
byte_offset_to_char_offset
get_line_content
Get the content of a specific line (1-indexed) from the full content.