最佳答案
我想这样:
for i := 0; i < len(str); i++ {
dosomethingwithrune(str[i]) // takes a rune
}
但事实证明,str[i]
的类型是 byte
(uint8
)而不是 rune
。
如何通过符号而不是字节来迭代字符串?