재우니의 블로그

c# 으로 중국문자여부를 찾는데는 아래 함수를 사용하면 간단히 알 수 있습니다.

 

public static bool Any(this string value, UnicodeCategory category) =>
    !string.IsNullOrWhiteSpace(value)
    && value.Any(@char => char.GetUnicodeCategory(@char) == category);
public static bool HasOtherLetter(this string value) => value.Any(UnicodeCategory.OtherLetter);

 

bool hasOtherLetter = text.HasOtherLetter();

 

 

발췌 : https://weblogs.asp.net/dixin/detect-chinese-character-in-unicode-string