Problem with split.(...)

This is actually exactly the same problem as Vectorization and passing a matrix as an argument - #2 by rdeits from earlier today. If you want each element in P to receive the entire vector ['{', '}'], then you can wrap that vector in a one-element tuple (to “scalarize” it):

julia> P = ["{foo", "bar}", "baz}"]
3-element Array{String,1}:
 "{foo"
 "bar}"
 "baz}"

julia> strip.(P, ['{', '}'])
ERROR: DimensionMismatch("arrays could not be broadcast to a common size")
Stacktrace:
 [1] _bcs1(::Base.OneTo{Int64}, ::Base.OneTo{Int64}) at ./broadcast.jl:70
 [2] _bcs at ./broadcast.jl:63 [inlined]
 [3] broadcast_shape at ./broadcast.jl:57 [inlined] (repeats 2 times)
 [4] broadcast_indices at ./broadcast.jl:53 [inlined]
 [5] broadcast_c at ./broadcast.jl:313 [inlined]
 [6] broadcast(::Function, ::Array{String,1}, ::Array{Char,1}) at ./broadcast.jl:455

julia> strip.(P, (['{', '}'],))
3-element Array{String,1}:
 "foo"
 "bar"
 "baz"

Also, please quote your code: PSA: how to quote code with backticks

1 Like