Documentation
¶
Overview ¶
Package ascii contains ASCII string/bytes helpers.
They are the helpers HTML parsers use: ASCII whitespace, and case folding of ASCII letters only (unlike strings.EqualFold and strings.ToLower), as the Infra Standard defines them. They work on bytes, which gives the same results as on the code points of UTF-8 text, since the bytes of multi-byte UTF-8 sequences aren't ASCII.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendLower ¶
AppendLower appends s to dst with ASCII letters lowercased.
func EqualFold ¶
EqualFold reports whether a and b are equal with ASCII letters compared case-insensitively (an ASCII case-insensitive match), as HTML parsers compare names and keywords (strings.EqualFold also folds other letters, such as U+017F to s).
func IsSpace ¶
IsSpace reports whether c is ASCII whitespace (space, tab, newline, form feed or carriage return), which HTML uses for whitespace.
func ToLower ¶
ToLower returns s with ASCII letters lowercased (the Infra Standard's ASCII lowercase), as HTML parsers lowercase names (other letters are kept). It only allocates if s has uppercase ASCII letters: otherwise, it returns s, which for a []byte is the same slice. It doesn't modify s.
func ToLowerByte ¶
ToLowerByte returns c lowercased if it is an ASCII letter, or c otherwise.
func TrimSpace ¶
TrimSpace returns s without leading and trailing ASCII whitespace, like the Infra Standard's strip leading and trailing ASCII whitespace. Unlike strings.TrimSpace, it doesn't remove other whitespace (such as vertical tabs or U+00A0).
Types ¶
This section is empty.