Vectorize replace with Vector of String raises DimensionMismatch

Since Pairs are also iterable you need to “protect” the pair from broadcasting with Ref, which makes it behave like a scalar instead:

julia> a = ["0,309042 46,586349 111,4", "0,309042 46,586349 111,1", "0,309042 46,586349 111,3"];

julia> replace.(a, Ref(","=>"."))
3-element Array{String,1}:
 "0.309042 46.586349 111.4"
 "0.309042 46.586349 111.1"
 "0.309042 46.586349 111.3"

Note, however, that in Julia 1.3 and later Pairs are treated as scalars by default, so the Ref is not needed there, see https://github.com/JuliaLang/julia/pull/32209.

3 Likes