whatwg_infra::strings

Function skip_ascii_whitespace

Source
pub fn skip_ascii_whitespace(s: &str, position: &mut usize)
Expand description

Moves the index of a string until it passes all ASCII whitespace.

See also: WHATWG Infra Standard definition

ยงExamples

use whatwg_infra::skip_ascii_whitespace;

let s = "\n\n\ntest";
let mut position = 0usize;
skip_ascii_whitespace(s, &mut position);

assert_eq!(position, 3);
assert_eq!(&s[position..], "test");