当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


GO RuneStart用法及代码示例


GO语言"unicode/utf8"包中"RuneStart"函数的用法及代码示例。

用法:

func RuneStart(b byte) bool

RuneStart 报告字节是否可能是编码的第一个字节,可能是无效的符文。第二个和后续字节的前两位始终设置为 10。

例子:

package main

import (
	"fmt"
	"unicode/utf8"
)

func main() {
	buf := []byte("a界")
	fmt.Println(utf8.RuneStart(buf[0]))
	fmt.Println(utf8.RuneStart(buf[1]))
	fmt.Println(utf8.RuneStart(buf[2]))
}

输出:

true
true
false

相关用法


注:本文由纯净天空筛选整理自golang.google.cn大神的英文原创作品 RuneStart。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。