How to determine a string is english or arabic?

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

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

8条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-31 18:27

    You can usually tell by the code points within the string itself. Arabic occupies certain blocks in the Unicode code space.

    It's a fairly safe bet that, if a substantial proportion of the characters exist in those blocks (such as بلدي الحوامات مليء الثعابينة), it's Arabic text.

提交回复
热议问题