title: Golang - ToUpper() on a single byte?
body: <p>I have a <code>[]byte</code>, <code>b</code>, and I want to select a single byte, <code>b[pos]</code> and change it too upper case (and then lower case) The <code>bytes</code> type has a method called <code>ToUpper()</code>. How can I use this for a single byte?</p>
  
  <h2>Calling <code>ToUpper</code> on single Byte</h2>
  
  <p>OneOfOne gave the most efficient (when calling thousands of times), I use</p>
  
  <pre><code>val = byte(unicode.ToUpper(rune(b[pos])))
  </code></pre>
  
  <p>in order to find the byte and change the value</p>
  
  <pre><code>b[pos] = val
  </code></pre>
  
  <h2>Checking if byte is Upper</h2>
  
  <p>Sometimes, instead of changing the case of a byte, I want to <strong>check if a byte is upper or lower case</strong>; All the upper case roman-alphabet bytes are <em>lower than the value</em> of the lower case bytes.</p>
  
  <pre><code>func (b Board) isUpper(x int) bool {
      return b.board[x] &lt; []byte{0x5a}[0]
  }
  </code></pre>