No setindex! method for String type

I was trying to assign a value to a certain position in a String variable and got this message: resized-shot

Is this a design decision? Is there another way to assign characters in a string? I found a workaround by using an array of Uint8 numbers and using the String( ::Array{Uint8,1} ) constructor, but that does not seem like an ideal solution.

Strings are not mutable in julia.
(infact in general mutable strings are rare across all modern programming languages.)

use Vector{Char} rather than Vector{UInt8}.

You can convert a String to a Vector{Char} using collect

2 Likes

Thanks. That sounds a lot better than what I was doing.