Start New Discussion within our Software Development Community

Just a little snippet to check if a string contains only letters.

using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string MyString = "A @string & and 2.";
            
            Console.WriteLine(MyString);
            for (int charpos = 0; charpos < MyString.Length; charpos++)
            {
                Console.WriteLine(Char.IsLetter(MyString, charpos));    
            }
            //Keep the console on screen
            Console.WriteLine("Press any key to quit.");
            Console.ReadKey();
        }
    }
}
The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.