咕泡BATJ必問(wèn)面試題錦集
yte.go
package main
import "fmt"
func main() {
? var b byte
? for b =0;b<177;b++{
? ? ?fmt.Printf("%d %c\n",b,b)
? }
}
rune.go
package main
import "fmt"
func main() {
// byte => uint8
// rune => int32
s := "golang你好"
fmt.Println(len(s))
cnt := 0
for _, r := range s {
cnt += 1
fmt.Printf("%c\n", r)
}
fmt.Println("cnt", cnt)
ss := []rune("hello")
fmt.Println(ss)
}
標(biāo)簽: