Say I have a vector of strings like this
julia> R = ["ABC","DEF"]
2-element Vector{String}:
"ABC"
"DEF"
Now I duplicate the elements to form a 2*2 matrix:
julia> x = [R R]
2×2 Matrix{String}:
"ABC" "ABC"
"DEF" "DEF"
What I want to achieve is to concatenate the strings from each row of the matrix. The best I could come up with is
julia> [join(x[i,:]) for i in 1:length(x)÷2]
2-element Vector{String}:
"ABCABC"
"DEFDEF"
which gives the desired result.
Are there alternative solutions (without an explicit loop)? I tried to find a working syntax with broadcasting but failed.
(Another idea I tried was
julia> x = [R,R]
2-element Vector{Vector{String}}:
["ABC", "DEF"]
["ABC", "DEF"]
julia> join.(x)
2-element Vector{String}:
"ABCDEF"
"ABCDEF"
which is "simpler" but obviously does not give the desired result.)