Swap two number

s is a String. If you iterate s, as you are doing, you get characters. The numbers you see are the code of the characters in the encoding it is being used.

julia> for c in "3493"; println(Int(c)); end
51
52
57
51

Instead of attributing the character to the Vector{Int64} directly, you should use parse.

julia> for c in "3493"; println(parse(Int, c)); end
3
4
9
3
3 Likes