So I have the string \"Hello World!\" and want to replace the \"!\" with \"?\" so that the new string is \"Hello World?\"
In Ruby we can do this easily with the gs
gs
Also you can use iterators and match expression:
match
let s:String = "Hello, world!".chars() .map(|x| match x { '!' => '?', 'A'..='Z' => 'X', 'a'..='z' => 'x', _ => x }).collect(); println!("{}", s);// Xxxxx, xxxxx?