Function is_xml_whitespace

Source
pub fn is_xml_whitespace<T: AsRef<[u8]>>(s: T) -> bool
Expand description

§Test if a string contains exclusively XML whitespace

This function returns true if s contains only XML whitespace. XML whitespace is defined as U+0020 (space), U+0009 (tab), U+000a (newline) and U+000d (carriage return), so this test is implemented on bytes instead of codepoints for efficiency.

§Example

assert!(is_xml_whitespace(" \t\r\n  "));
assert!(!is_xml_whitespace("  hello  "));