pub fn IndexAny(s: impl AsRef<[byte]>, chars: impl AsRef<str>) -> intExpand description
IndexAny interprets s as a sequence of UTF-8-encoded Unicode code points. It returns the byte index of the first occurrence in s of any of the Unicode code points in chars. It returns -1 if chars is empty or if there is no code point in common.
zh-cn
字符串chars中的任一utf-8编码在s中第一次出现的位置,如不存在或者chars为空字符串则返回-1§Example
use gostd_bytes as bytes;
assert_eq!(bytes::IndexAny("chicken", "aeiouy"),2);
assert_eq!(bytes::IndexAny("crwth", "aeiouy"),-1);
assert_eq!(bytes::IndexAny("chicken".as_bytes(), "aeiouy"),2);
assert_eq!(bytes::IndexAny("crwth".as_bytes(), "aeiouy"),-1);