GO语言"bytes"包中"Runes"函数的用法及代码示例。
用法:
func Runes(s []byte) []rune
Runes 将 s 解释为 UTF-8 编码的代码点序列。它返回一个相当于 s 的符文(Unicode 代码点)切片。
例子:
package main
import (
"bytes"
"fmt"
)
func main() {
rs := bytes.Runes([]byte("go gopher"))
for _, r := range rs {
fmt.Printf("%#U\n", r)
}
}
输出:
U+0067 'g' U+006F 'o' U+0020 ' ' U+0067 'g' U+006F 'o' U+0070 'p' U+0068 'h' U+0065 'e' U+0072 'r'
相关用法
- GO RuneCount用法及代码示例
- GO RuneStart用法及代码示例
- GO RuneLen用法及代码示例
- GO RuneCountInString用法及代码示例
- GO Regexp.FindString用法及代码示例
- GO Regexp.FindAllIndex用法及代码示例
- GO ResponseRecorder用法及代码示例
- GO ReverseBytes64用法及代码示例
- GO ReverseBytes16用法及代码示例
- GO Regexp.ReplaceAllLiteralString用法及代码示例
- GO Regexp.FindStringSubmatch用法及代码示例
- GO Rows用法及代码示例
- GO Regexp.FindAllString用法及代码示例
- GO ReadMessage用法及代码示例
- GO Regexp.ExpandString用法及代码示例
- GO ResponseWriter用法及代码示例
- GO Regexp.FindAllStringSubmatch用法及代码示例
- GO Reverse用法及代码示例
- GO Read用法及代码示例
- GO RotateLeft32用法及代码示例
注:本文由纯净天空筛选整理自golang.google.cn大神的英文原创作品 Runes。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。