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?
You can use regular expression to match with Supported Named Blocks:
private static readonly Regex cjkCharRegex = new Regex(@"p{IsCJKUnifiedIdeographs}"); public static bool IsChinese(this char c) { return cjkCharRegex.IsMatch(c.ToString()); }
Then, you can use:
if (sometext.Any(z=>z.IsChinese())) DoSomething();
1.4m articles
1.4m replys
5 comments
56.9k users