public class PigLatin extends Object
encrypt
method.
Pig-latin words are formed by shifting leading consonants of a word to the end, and adding "ay". If the word begins with a vowel, just add "way" (no shifting). So "Java" becomes "Avajay" while "out" becomes "outway". There are extra rules for dealing with "u" and "y". For simplicity this code treats hyphens and apostrophes as consonants, so words such as "I'll" and "Q-Tip" don't come out quite right.
Modifier and Type | Method and Description |
---|---|
static String |
encrypt(String text)
Encrypts text into Pig-latin.
|
static void |
main(String[] args)
This main method is used only as a test driver for the
encrypt(String) method. |
public static void main(String[] args)
encrypt(String)
method.args
- This is unused.