GO语言"strings"包中"IndexAny"函数的用法及代码示例。
用法:
func IndexAny(s, chars string) int
IndexAny 返回 s 中字符的任何 Unicode 代码点的第一个实例的索引,如果 s 中不存在字符的 Unicode 代码点,则返回 -1。
例子:
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.IndexAny("chicken", "aeiouy"))
fmt.Println(strings.IndexAny("crwth", "aeiouy"))
}
输出:
2 -1
相关用法
- GO IndexAny用法及代码示例
- GO Index.Lookup用法及代码示例
- GO IndexByte用法及代码示例
- GO IndexFunc用法及代码示例
- GO IndexRune用法及代码示例
- GO Index用法及代码示例
- GO Indent用法及代码示例
- GO Int.Scan用法及代码示例
- GO Ints用法及代码示例
- GO Intn用法及代码示例
- GO Info用法及代码示例
- GO Int.SetString用法及代码示例
- GO Inspect用法及代码示例
- GO IntsAreSorted用法及代码示例
- GO Itoa用法及代码示例
- GO IP.IsPrivate用法及代码示例
- GO IsDigit用法及代码示例
- GO IP.Equal用法及代码示例
- GO IsAbs用法及代码示例
- GO IP.IsLinkLocalMulticast用法及代码示例
注:本文由纯净天空筛选整理自golang.google.cn大神的英文原创作品 IndexAny。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。