Question : rust replace characters
Answered by : mackerel
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
Source : | Last Update : Sun, 28 Feb 21