RosettaCodeData/Task/String-matching/Julia/string-matching.julia

10 lines
279 B
Plaintext

startswith("abcd","ab") #returns true
search("abcd","ab") #returns 1:2, indices range where string was found
endswith("abcd","zn") #returns false
ismatch(r"ab","abcd") #returns true where 1st arg is regex string
julia>for r in each_match(r"ab","abab")
println(r.offset)
end
1
3