title: How to manipulate strings in GO to reverse them?
body: <p>I'm trying to invert a string in go but I'm having trouble handling the characters. Unlike C, GO treats strings as vectors of bytes, rather than characters, which are called runes here. I tried to do some type conversions to do the assignments, but so far I could not.</p>
  
  <p>The idea here is to generate 5 strings with random characters of sizes 100, 200, 300, 400 and 500 and then invert their characters. I was able to make C work with ease, but in GO, the language returns an error saying that it is not possible to perform the assignment.</p>
  
  <pre><code> func inverte() {
      var c = "A"
      var strs, aux string
  
      rand.Seed(time.Now().UnixNano())
      // Gera 5 vetores de 100, 200, 300, 400, e 500 caracteres
      for i := 1; i &lt; 6; i++ {
          strs = randomString(i * 100)
          fmt.Print(strs)
  
          for i2, j := 0, len(strs); i2 &lt; j; i2, j = i+1, j-1 {
             aux = strs[i2]
             strs[i2] = strs[j]
             strs[j] = aux
         }
     }
  }
  </code></pre>