internal static bool ContainsArabicLetters(string text)
{
foreach (char character in text.ToCharArray())
{
if (character >= 0x600 && character <= 0x6ff)
return true;
if (character >= 0x750 && character <= 0x77f)
return true;
if (character >= 0xfb50 && character <= 0xfc3f)
return true;
if (character >= 0xfe70 && character <= 0xfefc)
return true;
}
return false;
}There is a way to check that a string contains Arabic characters with regular expressions as in the following method:
internal bool HasArabicCharacters(string text)
{
Regex regex = new Regex(
"[\u0600-\u06ff]|[\u0750-\u077f]|[\ufb50-\ufc3f]|[\ufe70-\ufefc]");
return regex.IsMatch(text);
}This method simply checks that every character in the input text falls in the Unicode Character Code of Arabic characters. You can find all Arabic Unicode Character Codes in the following link http://www.unicode.org/charts/