package main
import "fmt"
func main() {
a := "abcdefg"
fmt.Println(a[0:4])
fmt.Println(a[0])
fmt.Println(string(a[0]))
for k,v := range a {
fmt.Println(k, v)
}
b := []byte(a)
fmt.Println(b[0])
}
结果:
abcd
97
a
0 97
1 98
2 99
3 100
4 101
5 102
6 103
97
网友评论