Detected if string Non English language C#
May 26
C Sharp , C# .NET, Csharp, Non- English, Regex, string 2 Comments
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 …
RSS
Email