Computer Science, asked by sspal8283, 9 months ago

Write a program in java using string manipulation to accept a sentence and convert the sentence into Piglatin form and display the New sentence

Answers

Answered by yashagarwal140
0

function translatePigLatin(str) {

 var newString = str + "way";

 

 if (/[qwrtypsdfghjklzxcvbnm]{1,}/i[Symbol.match](str[0])) {

 var firstConsonants = /[qwrtypsdfghjklzxcvbnm]{1,}/i[Symbol.match](str);

 var length = firstConsonants[0].length;

 var newStr = str.substr(length) + firstConsonants + "ay";

 return newStr;

   

 }

 

 return newString;

}

translatePigLatin("glove");

Similar questions