The undef isn’t really relevant here. The point is that you’re doing string(str, ...), where str is an array of strings (initially with one element).
string(["abc"]) gives ["abc"], which just isn’t what you want here.
If you want the easy answer, the way to join strings is…join() ![]()
julia> str1 = ["abc", "def", "ghi"]
3-element Vector{String}:
"abc"
"def"
"ghi"
julia> join(str1)
"abcdefghi"