Ok so this is my base pig latin code and I need it to detect and change the capital letters into lower case as well as move the end punctuation to the end of the pig latinized word. For example if I type "Hello!" it gives me "ello!Hay" when I want it to give me "Ellohay!". I have been trying to figure this out for a few days now.

namespace PigLatin
{
    class Program
    {
        static void Main(string[] args)
        {
            string pigWord = "";
            string sentence = "";
            string firstLetter;
            string restOfWord;
            string vowels = "AEIOUaeiou";
            string Cap = "QWERTYUIOPASDFGHJKLZXCVBNM";
            string Punc = ".,/?><\";:][}{\\|=+-_)(*&^%$#@!]";
            int letterPos;

            while (sentence.ToLower() != "quit")
            {
                Console.WriteLine("Please enter a sentence (or type \"quit\" to exit)");
                sentence = Console.ReadLine();
                {
                    foreach (string word in sentence.Split())
                    {
                        firstLetter = word.Substring(0, 1);
                        restOfWord = word.Substring(1, word.Length - 1);
                        letterPos = vowels.IndexOf(firstLetter);

                        if (letterPos == -1)
                        {
                            pigWord = restOfWord + firstLetter + "ay";
                        }
                        else
                        {
                            pigWord = word + "way";
                        }
                        Console.Write("{0} ", pigWord);
                    }
                }
            }
        }
    }
}

To detect if a character is a capital letter, use the IsUpper method (see here)
There is also an IsPunctuation method.

But how would I integrate it. Thats my whole problem.

Perhaps also have a look at this DaniWeb thread.

Right after you assign the variables inside the loop, check if firstLetter is upper case. If it is make it lower case and make the first character in restOfWord upper case.

Okay going to ask ... how is Pig Latin written? Honestly, I've never actually learned it hahaha. I sense a possibility to have some Regex fun (queue Jaws music)

AFAIK there's no consensus how piglatin is spoken or written.
@JOShealV(queue Jaws music): try to play the following notes on say a piano:
C C# C C# C C# C C# C C# C C# C C#

Really? well no wonder why I never learned it hahahaha. (And nicely done with the Jaws tunes there, got a good laugh). Let me check this out when I get home. But let me confirm

Take a word, and move the first character to right before the first found punctuation, and of course lowercase it. Now the new first character must me uppercased. Finally, append "ay" to the string, again right before the first punctuation.

Are we always working with one word here? Or could it be a sentence (I ask because how would that relate to punctuation if that's the case). Also, what if the first character isn't capitialzied? Is it still expected to be moved to the respective location? Or are we only looking for the first capital letter?

The rules usually apply to only one word at a time. The case of the characters only applies to written words for readability mainly. Usually any punctuation outside the word remains as is. The punctuation inside the word will usually move up one position since words don't normally start with punctuation. You can proabably find edge case that fall oputside these parameters, but, remember, piglatin itself was designed as a spoken language not a written one.

Thanks guys got it done works well!

Be a part of the DaniWeb community

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