luaur-common 0.1.1

Foundational data structures and flags for the luaur Luau-in-Rust toolchain.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::functions::is_whitespace::isWhitespace;

#[allow(non_snake_case)]
pub fn strip(mut s: &str) -> &str {
    while !s.is_empty() && isWhitespace(s.chars().next().unwrap()) {
        s = &s[1..];
    }

    while !s.is_empty() && isWhitespace(s.chars().next_back().unwrap()) {
        s = &s[..s.len() - 1];
    }

    s
}