I have []byte, band I want to select one byte, b[pos]and change it also in upper case (and then in lower case). The type byteshas a method called ToUpper(), How can I use this for one byte?
ToUpperSingle Byte Call
OneOfOne gave the most efficient (when called thousands of times), I use
val = byte(unicode.ToUpper(rune(b[pos])))
to find the byte and change the value
b[pos] = val
Check if byte is Upper
Sometimes, instead of changing the byte of a byte, I want to check if the byte is upper or lower case ; All bytes with an uppercase alphabet are lower than lowercase bytes.
func (b Board) isUpper(x int) bool {
return b.board[x] < []byte{0x5a}[0]
}