LastIndexAny
LastIndexAny 返回字符串 chars 中的任一utf-8码值在字符串 s 中最后一次出现的位置,如不存在或者chars为空字符串则返回-1。
LastIndexAny
函数定义
func LastIndexAny(s, chars string) int
代码示例
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.LastIndexAny("go gopher", "go")) //4
fmt.Println(strings.LastIndexAny("go gopher", "rodent")) //8
fmt.Println(strings.LastIndexAny("go gopher", "fail")) //-1
}