Skip to content

Commit

Permalink
core: Add WStr::eq_with_case
Browse files Browse the repository at this point in the history
  • Loading branch information
Herschel committed May 8, 2022
1 parent f39537f commit 43996db
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions wstr/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,21 @@ impl WStr {
super::ops::str_eq_ignore_case(self, other)
}

#[inline]
/// Compares two strings with the specified case sensitivity.
/// Note that the case mapping is different than Rust's case mapping.
pub fn eq_with_case<'a>(
&self,
other: impl Into<Units<&'a [u8], &'a [u16]>>,
case_sensitive: bool,
) -> bool {
if case_sensitive {
self == WStr::from_units(other.into())
} else {
self.eq_ignore_case(WStr::from_units(other.into()))
}
}

#[inline]
/// Compares two strings, ignoring case as done by the Flash Player.
/// Note that the case mapping is different than Rust's case mapping.
Expand Down

0 comments on commit 43996db

Please sign in to comment.