Why isn't string replace variadic?

replace(s::AbstractString, pat=>r; [count::Integer])

https://docs.julialang.org/en/v1/base/strings/#Base.replace-Tuple{AbstractString,%20Pair}

If I want to make two replacements in one pass I have to use regex? It seems like I should be able to do

replace("hello world", "hello" => "hi", "world" => "julia")

See `replace` does not handle multiple patterns for String · Issue #35327 · JuliaLang/julia · GitHub and implement replace on String for multiple patterns by vtjnash · Pull Request #40484 · JuliaLang/julia · GitHub.

2 Likes