def Text.is_control

bend-trace-context@0.2.0.0 · trace_context.bend:2810

import bend-trace-context@0.2.0.0/trace_context.bend as TraceContext
import Base

2810# Whether a character is a control character other than a horizontal tab:
2811# U+0000 to U+0008, U+000A to U+001F or U+007F. No field value may hold one
2812# (RFC 9110, section 5.5); a carriage return or a line feed would end the
2813# field.
2814def Text.is_control(char: Char) -> Bool:
2815  match char:
2816    case Chr{+code}:
2817      Bool.or(Bool.and(U32.is_lt(code, 32), Bool.not(U32.is_eq(code, 9))), U32.is_eq(code, 127))

Uses (7)

Used by (1)