take_char_at_j

Function take_char_at_j 

Source
pub fn take_char_at_j(s: &JsString, index: i64) -> Option<JsString>
Expand description

Take a single “character” at index, keeping surrogate pairs together.

This is the surrogate-pair-aware equivalent of the JS snippet in the prompt: if index points at a high surrogate and the next code unit is a low surrogate, returns both code units; otherwise returns one code unit.

Returns None if index is out of bounds.