pub fn ReplaceAll(
s: impl AsRef<[byte]>,
old: impl AsRef<[byte]>,
new: impl AsRef<[byte]>,
) -> Vec<byte> ⓘExpand description
ReplaceAll returns a copy of the slice s with all non-overlapping instances of old replaced by new. If old is empty, it matches at the beginning of the slice and after each UTF-8 sequence, yielding up to k+1 replacements for a k-rune slice.
zh-cn
返回将s中不重叠old切片序列都替换为new的新的切片拷贝。§Example
use gostd_bytes as bytes;
assert_eq!("moo moo moo".as_bytes(),bytes::ReplaceAll("oink oink oink".as_bytes(), "oink".as_bytes(), "moo".as_bytes()));