Right now we have:
startswith(haystack, needle)endswith(haystack, needle)occursin(needle, haystack)While occursin(needle, haystack) is right from the perspective of reading
f(a, b) as a f b
i.e. needle occursin haystack
It is not consistent with startwith or endswith.
Back in julia 0.6 (IIRC) we had contains(haystack, needle)
which still reads right: haystack contains needle.
I would like to suggest we bring it back so that we can have that consistency.
This is part of a series of issues relating to https://github.com/invenia/Wrangling.jl/pull/3
Will link others below for cross referencing.
https://github.com/JuliaLang/julia/issues/35032
https://github.com/JuliaLang/julia/issues/35033
Yes, I miss this a lot. IIRC, the reason we settled on occursin was that we were worried that contains(haystack, needle) confusing element containment with subsequence containment, but I think we already mix that up a bit so maybe it doesn't matter.
Ok I will make the PR to add contains after https://github.com/JuliaLang/julia/pull/35052 is merged
because I think it should also match startwith and endswith having curried versions.
Since it will follow that pattern
Most helpful comment
Ok I will make the PR to add
containsafter https://github.com/JuliaLang/julia/pull/35052 is mergedbecause I think it should also match
startwithandendswithhaving curried versions.Since it will follow that pattern