How to determine a string is english or arabic?

后端 未结 8 1187
我寻月下人不归
我寻月下人不归 2021-01-31 17:47

Is there a way to determine a string is English or Arabic?

8条回答
  •  猫巷女王i
    2021-01-31 18:05

    Try This :

    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;
    }
    

提交回复
热议问题