pub fn str_replace(s: &SmtString, p: &SmtString, r: &SmtString) -> SmtString
Expand description
Replace the first occurrence of p in s with r.
- Return s unchanged if p does not occur in s
§Panics
If the resulting string would have length larger than MAX_LENGTH
§Examples
use aws_smt_strings::smt_strings::*;
let s1 = SmtString::from("abcdef");
let s2 = SmtString::from("cde");
let s3 = SmtString::from("Z");
assert_eq!(str_replace(&s1, &s2, &s3), SmtString::from("abZf"));
assert_eq!(str_replace(&s1, &EMPTY, &s3), SmtString::from("Zabcdef"));