rust replace strings code example
Example: rust replace characters
let s:String = "Hello, world!".chars()
.map(|x| match x {
'!' => '?',
'A'..='Z' => 'X',
'a'..='z' => 'x',
_ => x
}).collect();
println!("{}", s);// Xxxxx, xxxxx?
// Avoids using Regex