RosettaCodeData/Task/Strip-control-codes-and-extended-characters-from-a-string/Rust/strip-control-codes-and-extended-characters-from-a-string.rs
2025-06-11 20:16:52 -04:00

10 lines
233 B
Rust

fn stripped(tostrip: &str) -> String {
return tostrip
.chars()
.filter(|c| !c.is_ascii_control() && c.is_ascii())
.collect();
}
fn main() {
println!("{}", stripped("\x08a\x00b\n\rc\x0cd\u{00c3}"));
}