(word: String, ch: char)
| 16 | } |
| 17 | |
| 18 | pub fn reverse_prefix(word: String, ch: char) -> String { |
| 19 | let s_index = word.find(ch); |
| 20 | match s_index { |
| 21 | Some(p) => { |
| 22 | let res = word.clone(); |
| 23 | let mut left = res[..p+1].chars().rev().collect::<String>(); |
| 24 | let right: String = res[p+1..].to_string(); |
| 25 | left.push_str(&right); |
| 26 | left |
| 27 | }, |
| 28 | None => word, |
| 29 | } |
| 30 | } |
nothing calls this directly
no outgoing calls
no test coverage detected