Function malachite_base::strings::string_is_subset
source · pub fn string_is_subset(s: &str, t: &str) -> bool
Expand description
Returns whether all of the first string slice’s characters are present in the second string slice.
Does not take multiplicities into account.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n + m)$
where $T$ is time, $M$ is additional memory, $n$ is s.len()
, and $m$ is t.len()
.
§Examples
use malachite_base::strings::string_is_subset;
assert_eq!(string_is_subset("oH, well", "Hello, world!"), true);
assert_eq!(string_is_subset("MMM", "Mississippi"), true);
assert_eq!(string_is_subset("Hello, World!", "Hello, world!"), false);
assert_eq!(string_is_subset("j", "Mississippi"), false);