# No setindex! method for String type

**URL:** <https://discourse.julialang.org/t/no-setindex-method-for-string-type/19794>\
**Category:** New to Julia\
**Created:** [January 18, 2019, 7:13pm UTC](https://discourse.julialang.org/t/no-setindex-method-for-string-type/19794 "2019-01-18T19:13:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aklapatch](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@aklapatch](https://discourse.julialang.org/u/aklapatch)\
**Post date:** [January 18, 2019, 7:13pm UTC](https://discourse.julialang.org/t/no-setindex-method-for-string-type/19794/1 "2019-01-18T19:13:45Z")

</div>

I was trying to assign a value to a certain position in a String variable and got this message: ![resized-shot](https://global.discourse-cdn.com/julialang/original/3X/9/4/94641ca753c2a82e239aa164eb75904a0275c2fc.png)

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.

---

<div class="post-metadata">

**Author:** ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Post date:** [January 18, 2019, 7:18pm UTC](https://discourse.julialang.org/t/no-setindex-method-for-string-type/19794/2 "2019-01-18T19:18:55Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![aklapatch](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@aklapatch](https://discourse.julialang.org/u/aklapatch)\
**Post date:** [January 19, 2019, 8:03pm UTC](https://discourse.julialang.org/t/no-setindex-method-for-string-type/19794/3 "2019-01-19T20:03:04Z")

</div>

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