GO語言"bytes"包中"LastIndexAny"函數的用法及代碼示例。
用法:
func LastIndexAny(s []byte, chars string) int
LastIndexAny 將 s 解釋為 UTF-8 編碼的 Unicode 代碼點序列。它返回 chars 中任何 Unicode 代碼點在 s 中最後一次出現的字節索引。如果 chars 為空或沒有共同的代碼點,則返回 -1。
例子:
package main
import (
"bytes"
"fmt"
)
func main() {
fmt.Println(bytes.LastIndexAny([]byte("go gopher"), "MüQp"))
fmt.Println(bytes.LastIndexAny([]byte("go 地鼠"), "地大"))
fmt.Println(bytes.LastIndexAny([]byte("go gopher"), "z,!."))
}
輸出:
5 3 -1
相關用法
- GO LastIndex用法及代碼示例
- GO LastIndexFunc用法及代碼示例
- GO LastIndexByte用法及代碼示例
- GO LeadingZeros32用法及代碼示例
- GO Logger.Output用法及代碼示例
- GO Log10用法及代碼示例
- GO Log用法及代碼示例
- GO LeadingZeros8用法及代碼示例
- GO LeadingZeros16用法及代碼示例
- GO ListenAndServe用法及代碼示例
- GO Listener用法及代碼示例
- GO Logger用法及代碼示例
- GO Len8用法及代碼示例
- GO ListenAndServeTLS用法及代碼示例
- GO LoadLocation用法及代碼示例
- GO Len64用法及代碼示例
- GO LoadX509KeyPair用法及代碼示例
- GO LookPath用法及代碼示例
- GO LookupEnv用法及代碼示例
- GO Len32用法及代碼示例
注:本文由純淨天空篩選整理自golang.google.cn大神的英文原創作品 LastIndexAny。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。