Adding latest

This commit is contained in:
2020-11-25 01:19:16 +00:00
parent c0ae7d3f45
commit 8ac081813c

View File

@@ -14,12 +14,21 @@ fn pig_latin(string: &str) -> String {
let s = String::from(string);
let mut latinised = String::new();
let vowels = ['a', 'e', 'i', 'o', 'u'];
let mut starts_with_vowel = false;
let first_character = s.chars().next().unwrap();
if vowels.contains(&first_character) {
latinised = format!("{}-hay", &s);
starts_with_vowel = true;
} else {
latinised = format!("{}ay", &first_character);
latinised = format!("-{}ay", &first_character);
}
for (pos, char) in s.char_indices() {
if pos == 0 && starts_with_vowel {
continue
} else {
}
}
latinised
}