Hi guys. I'm in a beginning C# class and I' having trouble with an assignment. I need to make a windows forms application that takes English text from a text box, converts it to Pig Latin, and then returns it to a second text box.

The specifications are:

If a word starts with a vowel, add "way" to the end of the word.

If a word starts with a consonant, move the consonants before the first vowel to the end of the word and add "ay".

If a word starts with the letter Y, the Y should be treated as a consonant. If the Y appears anywhere else in the word, it should be treated as a vowel.

Keep the case of the original word whether it's uppercase (TEST), title case (Test), or lowercase (test).

Keep all punctuation at the end of the translated word.

Translate words with contractions. For example, "can't" should be "an'tcay".

Don't translate words that contain numbers or symbols. For example, 123 should be left as 123 and bill@microsoft.com should be left as bill@microsoft.com.

Check that the user has entered text before performing the translation.

If anyone can help it would be greatly appreciated!


Since this is an assignment, giving you the code wouldn't help you learn. But I will tell you how I'd go about some of the things.

String.Split() to get the individual words.
Regex to see if it contains numbers or symbols.
I'd check the case of the word and convert the 'translated' word to that case.

So, give it a try and tell us what errors you are getting.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.