Mega Code Archive

 
Categories / C# / Regular Expressions
 

Validates the exchange code with regular expression

//Microsoft Public License (Ms-PL) //http://c4fdevkit.codeplex.com/license using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; namespace C4F.DevKit.WebServices {     /// <summary>     /// Provides useful methods like conversion methods.     /// </summary>     public static class Utility     {         /// <summary>         /// Validates the exchange code         /// </summary>         /// <param name="exchangeCode">Exchange code to be validated</param>         /// <returns>True, if exchange code is valid</returns>         public static bool ValidateExchangeCode(string exchangeCode)         {             if (String.IsNullOrEmpty(exchangeCode))                 return false;             return Regex.IsMatch(exchangeCode, "^[0-9]{3}$");         }     } }