Detect if string Non English language C#

 

This class will help you to detect if the string contains non English characters ,

The System.Text.RegularExpressions namespace contains classes that provide access to the .NET Framework regular expression engine. ( Regex )

 

public bool IsEnglish(string inputstring)
{
    Regex regex = new Regex(@"[A-Za-z0-9 .,-=+(){}\[\]\\]");
    MatchCollection matches = regex.Matches(inputstring);

    if (matches.Count.Equals(inputstring.Length))
        return true;
    else
        return false;
}

Enjoy …

Comments

  1. Pingback: payday loans uk

Leave a Reply

Your email address will not be published.