GO語言"unicode/utf8"包中"FullRune"函數的用法及代碼示例。
用法:
func FullRune(p []byte) bool
FullRune 報告 p 中的字節是否以符文的完整 UTF-8 編碼開頭。無效編碼被視為完整符文,因為它將轉換為寬度為 1 的錯誤符文。
例子:
package main
import (
"fmt"
"unicode/utf8"
)
func main() {
buf := []byte{228, 184, 150} // 世
fmt.Println(utf8.FullRune(buf))
fmt.Println(utf8.FullRune(buf[:2]))
}
輸出:
true false
相關用法
- GO FullRuneInString用法及代碼示例
- GO Func用法及代碼示例
- GO Fscanln用法及代碼示例
- GO Float.SetString用法及代碼示例
- GO FileServer用法及代碼示例
- GO FieldsFunc用法及代碼示例
- GO Fprintln用法及代碼示例
- GO FormatMediaType用法及代碼示例
- GO Float64s用法及代碼示例
- GO Fprintf用法及代碼示例
- GO Fprint用法及代碼示例
- GO Floor用法及代碼示例
- GO FormatUint用法及代碼示例
- GO FormatBool用法及代碼示例
- GO Float64sAreSorted用法及代碼示例
- GO Float.Scan用法及代碼示例
- GO FormatFloat用法及代碼示例
- GO FileMode用法及代碼示例
- GO Float.Add用法及代碼示例
- GO Frames用法及代碼示例
注:本文由純淨天空篩選整理自golang.google.cn大神的英文原創作品 FullRune。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。