Diskdrive Diskdrive - 5 months ago 43
C# Question

Is there a way to check whether unicode text is in a certain language?

I'll be getting text from a user that I need to validate is a Chinese character.

Is there any way I can check this?


According to the information provided here in unicode website you can find the block of Chinese or any other language and then implement a parser to check if a word is in the range or no. just like

public bool IsChinese(string text)
    return text.Any(c => c >= 0x20000 && c <= 0xFA2D);

Note that

As a handy reference, the Unicode Consortium here provides a search interface to the Unicode Hàn (漢) Database (Unihan).

The database link I'd provided above is showing you the characters