Rust Replace Characters

[Solved] Rust Replace Characters | Solidity - Code Explorer | yomemimo.com
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

Answers related to rust replace characters

Code Explorer Popular Question For Solidity