How to Check if a Specific String is Contained in Julia
Code
julia> contains("qwerty", "er")
true
julia> contains("qwerty", "et")
false
julia> contains("qwerty", r"q?")
true
contains(haystack::AbstractString, needle)
- Returns a boolean indicating whether
needleis contained inhaystack.needlecan include regular expressions, such asr"...".
Note that ‘haystack’ means a hay pile, referring to the idiom “a needle in a haystack”.
Environment
- OS: Windows
- julia: v1.6.2
