Advertisement
Guest User

Untitled

a guest
Nov 29th, 2015
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. package prob2;
  2.  
  3. public class PigLatin {
  4. public static void main(String[] args){
  5. String english = "this is a test";
  6. english = english.trim();
  7. String[] split = english.split(" ");
  8. for(String s : split)
  9. s = s.trim();
  10.  
  11. for(int i = 0; i < split.length; i++)
  12. if(split[i].length() > 0)
  13. if(split[i].charAt(0) == 'a' || split[i].charAt(0) == 'e' || split[i].charAt(0) == 'i' || split[i].charAt(0) == 'o' || split[i].charAt(0) == 'u' || split[i].charAt(0) == 'A' || split[i].charAt(0) == 'E' || split[i].charAt(0) == 'I' || split[i].charAt(0) == 'O' || split[i].charAt(0) == 'U')
  14. split[i] += "hay";
  15. else if(((int)(split[i].charAt(0)) >= 65 && (int)(split[i].charAt(0)) <= 90) || ((int)(split[i].charAt(0)) >= 97 && (int)(split[i].charAt(0)) <= 122))
  16. split[i] = split[i].substring(1) + split[i].charAt(0) + "ay";
  17.  
  18. for(String s : split)
  19. System.out.print(s + " ");
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement