How does one convert a string to a lowercase or perform some kind of equivalency comparison ignoring case? There is an ignore case on the Ascii
type but it seems convoluted and I don't see a way to convert str
to Ascii
.
std::ascii::AsciiExt.eq_ignore_ascii_case
does what you want:
use std::ascii::AsciiExt;
fn main() {
assert!("foo".eq_ignore_ascii_case("FOO"));
}
(The search in the docs is quite good now; searches like "case" and "ascii" return good sets of results which contain this solution.)