whatwg_infra::surrogates

Function is_trailing_surrogate_utf16

Source
pub const fn is_trailing_surrogate_utf16(c: u16) -> bool
Expand description

Checks if a u16 is a UTF-16 codepoint defined in the range of U+DC00 to U+DFFF, inclusive.

See also: WHATWG Infra Standard definition

ยงExamples

use whatwg_infra::surrogates::is_trailing_surrogate_utf16;

assert_eq!(is_trailing_surrogate_utf16(0xDB99u16), false);
assert_eq!(is_trailing_surrogate_utf16(0xDC00u16), true);
assert_eq!(is_trailing_surrogate_utf16(0xDFFFu16), true);
assert_eq!(is_trailing_surrogate_utf16(0xE000u16), false);