Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String pigLatin(String sentence){
- //convert to lower case -- String class toLowerCase method
- String lower = sentence.toLowerCase();
- //divide into words -- split(" ") -- returns an ARRAY of strings
- String[] splits = lower.split(" ");
- //loop over the array
- for(int i=0; i<splits.length; i++){
- pigLatinWord(splits[i]);
- }
- //inside the loop call the helper method to convert word
- return "";
- }
- public static String pigLatinWord(String word){
- //find a vowel -- charAt and loop
- if((s.charAt(0)==('a')||(s.charAt(0)==('e')||(s.charAt(0)==('i')||(s.charAt(0)==('o')||(s.charAt(0)==('u'))))))){
- returnable = word+"way";
- }
- else{
- for(int i=0; i<word.length; i++){
- }
- }
- //substring -- from vowel position(looping variable) to end, and again from 0 to vowel
- //return
- return "";
- }
Add Comment
Please, Sign In to add comment