Function uncased::eq

source ·
pub fn eq<S1: AsRef<str>, S2: AsRef<str>>(s1: S1, s2: S2) -> bool
Expand description

Returns true if s1 and s2 are equal without considering case.

That is, this function returns s1.to_ascii_lowercase() == s2.to_ascii_lowercase(), but does it in a much faster way. This is also equivalent to UncasedStr::new(s1) == UncasedStr::new(s2).

Example

assert!(uncased::eq("ENV", "env"));
assert!(uncased::eq("bRoWN", "BROWN"));
assert!(uncased::eq("hi", "HI"));
assert!(uncased::eq("dogs are COOL!", "DOGS are cool!"));