c USES the unicode encoding to determine whether a character is Shared as a Chinese example

  • 2020-06-01 10:56:35
  • OfStack


protected bool IsChineseLetter(string input,int index)
{
int code = 0;
int chfrom = Convert.ToInt32("4e00", 16); // Range ( 0x4e00 ~ 0x9fff ) into int ( chfrom ~ chend ) 
int chend = Convert.ToInt32("9fff", 16);
if (input != "")
{
code = Char.ConvertToUtf32(input, index); // Get the string input Specified index in index In character unicode coding 
if (code >= chfrom && code <= chend) 
{
return true; // when code Return in Chinese true
}
else
{
return false ; // when code Return not in Chinese false
}
}
return false;
}


Related articles: