Simple wrapper that checks if a character or substring has an exact match in a string. Really just a wrapper around grepl.

char %within% string

Arguments

char

a character or substring to look for

string

a string in which to match the character or substring

Examples

if ("w" %within% "hello, world!") print("Found it!")
#> [1] "Found it!"
"char" %within% "character string"
#> [1] TRUE