std.utf8.valid_scalar?
Show source codeHide source code
fn pub valid_scalar?(value: Int) -> Bool {
value >= 0 and value <= MAX_CODEPOINT and (value < 0xD800 or value > 0xDFFF)
}
fn pub static valid_scalar?(value: Int) -> Bool
Returns true
if the given Int
is a valid Unicode scalar value.
Examples
import std.utf8
utf8.valid_scalar?(0x5C) # => true
utf8.valid_scalar?(0xDFFF) # => false