str_replace_all

Function str_replace_all 

Source
pub fn str_replace_all(s: &SmtString, p: &SmtString, r: &SmtString) -> SmtString
Expand description

Replace all occurrences of p in s with r.

  • return s unchanged if p is the empty string or if p doesn’t 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("abcdcdef");
let s2 = SmtString::from("cd");
let s3 = SmtString::from("Z");

assert_eq!(str_replace_all(&s1, &s2, &s3), SmtString::from("abZZef"));
assert_eq!(str_replace_all(&s1, &EMPTY, &s2), s1);