Would somebody suggest:
string comparison by template, something like str==“us*”, where * is mean any symbol
thanks
Would somebody suggest:
string comparison by template, something like str==“us*”, where * is mean any symbol
thanks
julia> occursin(r"^us.*", "usage")
true
julia> occursin(r"^us.*", "bus")
false
thanks =)
Just FYI, if you’re only interested in strings that start with "us"
, there’s a specialized function on string for that:
julia> startswith("usage", "us")
true
I only mention it, because this approach is faster than a regexp match for this limited case (though, obviously not as flexible).