$Search: char, rune
Go has 2 types of characters:
byte
is a 1 byte value, an alias for uint8
typerune
is a 4 byte Unicode code-point, an alias for int32
typeZero value of a byte
and rune
is 0.
https://codeeval.dev/gist/ecb398f0f39d4385a15a54f1bf5c0661
https://codeeval.dev/gist/8f1de8d5bc674ca214bb18095db20d87
A string is an array of bytes.
When iterating a string as runes we assume the string is Unicode string encoded as UTF-8.
UTF-8 is a variable-length encoding where a rune can be encoded as 1, 2, 3 or 4 bytes.
The returned index i
is a byte position within the string where the rune starts. It's not a rune count.