byte == uint8
rune == int32
package main
import (
"fmt"
)
func main() {
s := reverse("冉rxy!")
fmt.Println(s)
}
func reverse(s string) string {
var r = []rune(s)
for i, j := 0, len(r)-1; i < j; i++ {
r[i], r[j] = r[j], r[i]
j--
}
return string(r)
}
[]byte to string:
string(b)