Guest User

Untitled

a guest
Jan 11th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. public static String pigLatin(String sentence){
  2. //convert to lower case -- String class toLowerCase method
  3. String lower = sentence.toLowerCase();
  4. //divide into words -- split(" ") -- returns an ARRAY of strings
  5. String[] splits = lower.split(" ");
  6. //loop over the array
  7. for(int i=0; i<splits.length; i++){
  8. pigLatinWord(splits[i]);
  9. }
  10. //inside the loop call the helper method to convert word
  11. return "";
  12. }
  13.  
  14. public static String pigLatinWord(String word){
  15. //find a vowel -- charAt and loop
  16. if((s.charAt(0)==('a')||(s.charAt(0)==('e')||(s.charAt(0)==('i')||(s.charAt(0)==('o')||(s.charAt(0)==('u'))))))){
  17. returnable = word+"way";
  18. }
  19. else{
  20. for(int i=0; i<word.length; i++){
  21.  
  22. }
  23. }
  24. //substring -- from vowel position(looping variable) to end, and again from 0 to vowel
  25. //return
  26. return "";
  27. }
Add Comment
Please, Sign In to add comment