通过在go
通过runes迭代字符串,使用范围关键字。例如: for POS,char:= range“日本语” { fmt.printf(“字符%c从字节位置%d \ n开始”,char,pos) } [2 字符本从字节位置3开始 character 語 starts at byte position 6
The range syntax does the following:Iterates from 0 to the length of the string
for pos, char := range "日本語" { fmt.Printf("character %c starts at byte position %d\n", char, pos) }
免责声明: 提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发到邮箱:[email protected] 我们会第一时间内为您处理。
Copyright© 2022 湘ICP备2022001581号-3