通过在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