fn main() {
let array = [
"Rust!!!",
"...c",
"java,,,",
"c++",
"**python__",
".S.Q.L.",
];
for s in &array {
println!("{}", trim_punctuation(s));
}
}
fn trim_punctuation(s: &str) -> String {
let chars_to_trim: &[_] = &['*', '!', ',', '.', '_'];
s.trim_matches(chars_to_trim).to_string()
}
/*
run:
Rust
c
java
c++
python
S.Q.L
*/