I was wondering what is the proper way to test whether a substring is included in some other string. If I want to check if string a
is part of string b
, I'm currently using
matchstr(b, a) != ""
to check if a is a substring of b. Is there a more "proper" way of doing it, since this seems like a bit of a hack.
matchstr
like this, 2nd arg ofmatchstr
is a regex pattern, eg:matchstr('ab', '.')
will return'a'
.