Help to shorten the code
The Rust Programming Language Forum
Help to shorten the code
I have the following code fn main() { let text = ".?;,!!!"; println!("{:?}", norm(text)); let text = ".?;,!!"; println!("{:?}", norm(text)); let text = ".?;,!"; println!("{:?}", norm(text)); } fn norm<'a>(splittersp: &'a str) -> (&'a str, bool) { let mut res = false; let splitters = if let Some(stripped) = splittersp.strip_suffix("!!") { if splittersp.len() > 2 { if splittersp.chars().nth_back(2).unwrap() != '!' { &splitters...
0 comments
No comments yet.