pub fn LastIndexAny(s: impl AsRef<[byte]>, chars: impl AsRef<str>) -> intExpand description
LastIndexAny interprets s as a sequence of UTF-8-encoded Unicode code points. It returns the byte index of the last 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!(4,bytes::LastIndexAny("go gopher", "go"));
assert_eq!(8,bytes::LastIndexAny("go gopher", "ordent"));
assert_eq!(-1,bytes::LastIndexAny("go gopher", "fail"));
assert_eq!(4,bytes::LastIndexAny("go gopher".as_bytes(), "go"));
assert_eq!(8,bytes::LastIndexAny("go gopher".as_bytes(), "ordent"));
assert_eq!(-1,bytes::LastIndexAny("go gopher".as_bytes(), "fail"));