Java Program to Convert String into PigLatin encoding.

 

import java.util.Scanner;

class PigLatin
{

public static void main(String[] arg)
{
Scanner sc = new Scanner(System.in);

System.out.print("Enter String");
String strsc.nextLine();
 
 //Converting the string into UpperCase
String str1=str.toUpperCase();


for(int i=0 ;i<str1.length();i++)
{
  if(str1.charAt(i)=='A'||str1.charAt(i)=='E'||str1.charAt(i)=='I'||
str1.charAt(i)=='O'||str1.charAt(i)=='U')
    {
         System.out.print(str1.substring(i)+str1.substring(0,i)+"AY");
         break;
   
    }
}
    
}
}

Comments

Popular posts from this blog

Java Program to replace vowel with next immediate character alphabetically in a String.

Java Program to count and output the number of double letter sequences that exist in the string.

Java Program to find the minimum and maximum palindrome String in a Sentence