go语言 rune切片 示例
package main import ( "fmt" ) //http://www.cnblogs.com/osfipin/ func main() { var s = "go程序" var r = []rune(s) fmt.Printf("%c ", s[1]) fmt.Printf("%c ", r[1]) fmt.Printf("%c ", s[3]) fmt.Printf("%c ", r[3]) }
运行结果:
o o
¨ 序
针对汉字 utf8字符