
Check if Strings are subsets of each other.
is_subset_bidirectional.Rd
For each pair of strings in the input vectors str1
and str2
, checks if
one string is a subset of another in both directions.
Arguments
- str1, str2
A pair of character vectors with the same
length
, or any of them has a length of1
. If the latter applies, then all values of the other vector are compared with the unique value in the shorter one.
Value
A logical vector indicating whether each corresponding pair of strings satisfies the subset condition.
Examples
is_subset_bidirectional("hello", "hi") # FALSE
#> [1] FALSE
is_subset_bidirectional(c("hello", "world"), c("hello world", "world hello")) # TRUE TRUE
#> [1] TRUE TRUE
is_subset_bidirectional("hello", c("hello", "world")) # TRUE FALSE
#> [1] TRUE FALSE
is_subset_bidirectional(c("hello", "world"), "hello world") # TRUE TRUE
#> [1] TRUE TRUE