()
| 1 | fn main() { |
| 2 | let alice = String::from("I like dogs"); |
| 3 | let bob: String = alice.replace("dog", "cat"); |
| 4 | |
| 5 | println!("Alice says: {}", alice); |
| 6 | println!("Bob says: {}", bob); |
| 7 | println!("Bob says again: {}", bob); |
| 8 | |
| 9 | let pangram: &'static str = "the quick brown fox jumps over the lazy"; |
| 10 | println!("Pangram: {}", pangram); |
| 11 | |
| 12 | println!("Words in reverse"); |
| 13 | for word in pangram.split_whitespace().rev() { |
| 14 | println!("> {}", word); |
| 15 | } |
| 16 | |
| 17 | let mut chars: Vec<char> = pangram.chars().collect(); |
| 18 | chars.sort(); |
| 19 | chars.dedup(); |
| 20 | |
| 21 | let mut string = String::new(); |
| 22 | for c in chars { |
| 23 | string.push(c); |
| 24 | string.push_str(", "); |
| 25 | } |
| 26 | |
| 27 | let chars_to_trim: &[char] = &[' ', ',']; |
| 28 | let trimmed_str: &str = string.trim_matches(chars_to_trim); |
| 29 | println!("Used characters: {}", string); |
| 30 | println!("Trimmed characters: {}", trimmed_str); |
| 31 | } |
nothing calls this directly
no outgoing calls
no test coverage detected