Macro replace_str

Source
macro_rules! replace_str {
    ( $string:expr; $( $pair:expr ),* ) => { ... };
}
Expand description

Replaces multiple str at once, avoiding intermediate allocations. It returns a new String containing the result. Values passed by value keep ownership.

ยงExamples

 
let s = "Ciao bello";
 
let s_replaced = replace_str!( s;
    ["ia", "u"],
    ["ll", ""]
);
 
assert_eq!(s_replaced, "Cuo beo");