Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 477 Bytes

acronym.md

File metadata and controls

20 lines (16 loc) · 477 Bytes

Acronym

fn create_acronym(source: &str) -> String {
  source
    .split_whitespace()
    .flat_map(|s| s.chars().nth(0))
    .collect::<String>()
    .to_ascii_uppercase()
}


fn main() {
  println!("{}", create_acronym("To Be Done"));
  println!("{}", create_acronym("As far as I know"));
  println!("{}", create_acronym("Looks good to me"));
}

Playground