Inconsistency between `replace` on an `AbstractString` vs. `Vector{Char}`

replace("foobar", "o" => "O", "b" => "B")

gives a method error, but

String(replace(Vector{Char}("foobar"), 'o' => 'O', 'b' => 'B'))

returns “fOOBar”.

That means you can’t optimize the replace operation, so that all characters or strings being replaced can be checked once, instead of doing multiple replacement passes on the string, with all the overhead that entails.


So basically another method needs to be implemented? Everybody is quite busy with breaking changes right now, this kind of feature can be added in 1.x releases.


I said nothing about it’s priority - I was just noting it, as something that hopefully will be addressed at some point, having just gotten bitten by it when I had to convert some code with the deprecated replace(string, txt, rep) to replace(string, txt => rep).


Actually, @klacru has just made a PR to implement this, we just need to find somebody who has skills and time to review it:


I would if I could.