Guest User

Untitled

a guest
Oct 20th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. def translate(word)
  2. if word[0] == ('a' || 'e' || 'i' || 'o' || 'u')
  3. result = word + "ay"
  4.  
  5. elsif word[0..1] == "qu"
  6. result = word[2..-1] + word[0..1] + "ay"
  7.  
  8. else
  9. vowel_position = 0
  10. found = false
  11. word.length.times do |x|
  12. if (['a', 'e', 'i', 'o', 'u'].include? word[x]) && (found == false)
  13. vowel_position = x
  14. found = true
  15. end
  16. end
  17. result = word[vowel_position..-1] + word[0..vowel_position-1] + "ay"
  18. end
  19. end
Add Comment
Please, Sign In to add comment