LastIndexByte
LastIndexByte 返回 c 在字符串 s 中最后一次出现的位置,如不存在则返回-1。
LastIndexByte
函数定义
func LastIndexByte(s string, c byte) int
代码示例
package main
import (
"fmt"
"strings"
"unicode"
)
func main() {
fmt.Println(strings.LastIndexFunc("go 123", unicode.IsNumber)) //5
fmt.Println(strings.LastIndexFunc("123 go", unicode.IsNumber)) //2
fmt.Println(strings.LastIndexFunc("go", unicode.IsNumber)) //-1
}