pub trait IgnoreCaseExt {
// Required methods
fn to_folded_case(&self) -> String;
fn eq_ignore_case(&self, other: &str) -> bool;
fn cmp_ignore_case(&self, other: &str) -> Ordering;
}
Required Methods§
Sourcefn to_folded_case(&self) -> String
fn to_folded_case(&self) -> String
Returns a case folded equivalent of this string, as a new String.
Case folding is primarily based on lowercase mapping, but includes additional changes to the source text to help make case folding language-invariant and consistent. Case folded text should be used solely for processing and generally should not be stored or displayed.
Sourcefn eq_ignore_case(&self, other: &str) -> bool
fn eq_ignore_case(&self, other: &str) -> bool
Checks that two strings are a case-insensitive match.
Essentially to_folded_case(a) == to_folded_case(b)
, but without
allocating and copying string temporaries. Because case folding involves
Unicode table lookups, it can sometimes be more efficient to use
to_folded_case
to case fold once and then compare those strings.
Sourcefn cmp_ignore_case(&self, other: &str) -> Ordering
fn cmp_ignore_case(&self, other: &str) -> Ordering
Compares two strings case-insensitively.
Essentially to_folded_case(a) == to_folded_case(b)
, but without
allocating and copying string temporaries. Because case folding involves
Unicode table lookups, it can sometimes be more efficient to use
to_folded_case
to case fold once and then compare those strings.
Note that this only ignores case, comparing the folded strings without any other collation data or locale, so the sort order may be surprising outside of ASCII characters.