title: How can I iterate over a string by runes in Go?
body: <p>I wanted to this:</p>
  
  <pre><code>for i := 0; i &lt; len(str); i++ {
      dosomethingwithrune(str[i]) // takes a rune
  }
  </code></pre>
  
  <p>But it turns out that <code>str[i]</code> has type <code>byte</code> (<code>uint8</code>) rather than <code>rune</code>.</p>
  
  <p>How can I iterate over the string by runes rather than bytes?</p>