diff --git a/src/pig_latin.rs b/src/pig_latin.rs new file mode 100644 index 0000000..abf130b --- /dev/null +++ b/src/pig_latin.rs @@ -0,0 +1,28 @@ +// Take a &str +// - assume single words (check for no spaces) +// - convert to String +// pop the first +// append ay +// move to end +// Handle sentences: take a &str, convert to array, then do the above for each and return +// a new array +// https://scottwlaforest.com/rust/the-rust-book-chapter-8-exercises/ + +// NOTE: Check for vowels! + +fn pig_latin(string: &str) -> String { + let s = String::from(string); + println!("{:?}", s.chars()); + s +} + +#[cfg(test)] +mod test { + use super::*; + #[test] + fn test_pig_latin() { + let string = "rustā¤"; + let result = pig_latin(string); + println!("{}", result); + } +}