Java: how to check if character belongs to a specific unicode block?

前端 未结 5 399
故里飘歌
故里飘歌 2021-01-04 02:43

I need to identify what natural language my input belongs to. The goal is to distinguish between Arabic and English words in a mixed input, where the inpu

5条回答
  •  时光取名叫无心
    2021-01-04 03:26

    The Unicode Script property is probably more useful. In Java, it can be looked up using the java.lang.Character.UnicodeScript class:

    Character.UnicodeScript script = Character.UnicodeScript.of(c);
    

提交回复
热议问题