rust replace characters 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