Method for Special Character Checkl

CodeKeep C# Feed Aprile 30th, 2008

Description: This method check a file name character

Link: http://www.codekeep.net/snippets/b0da90e1-1e30-42c5-91a6-8009b6d8fc29.aspx

public bool isSpecialCharacterExist(string strText, string strSpecialCharacters)
        {
            try
            {
                string strPattern = "[^a-zA-Z" + strSpecialCharacters + "]";
                Regex objRegex = new Regex(strPattern);
                bool result = objRegex.IsMatch(strText);
                return result;
            }
            catch
            {
                return true;
            }
        }

  • .NET
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Comments are closed.

Trackback URI |