Get Chinese characters

xiaoxiao2021-03-06  41

///

/// Gets the Chinese characters.

/// Private string getpychar (char c) {INT TMP = 65536 GetASCII (C); IF (TMP> = 45217 && TMP <= 45252) Return "a"; Else IF (TMP> = 45253 && TMP <= 45760) RETURN "B"; ELSE IF (TMP> = 45761 && TMP <= 46317) Return "C"; ELSE IF (TMP> = 46318 && TMP <= 46825) Return "D"; Else IF (TMP > = 46826 && tmp <= 47009) Return "E"; ELSE IF (TMP> = 47010 && TMP <= 47296) Return "F"; ELSE IF (TMP> = 47297 && TMP <= 47613) Return "G"; ELSE IF (TMP> = 47614 && TMP <= 48118) Return "H"; Else IF (TMP> = 48119 && TMP <= 49061) Return "J"; Else IF (TMP> = 49062 && TMP <= 49323) Return "K"; Else IF (TMP> = 49324 && TMP <= 49895) Return "L"; Else IF (TMP> = 49896 && TMP <= 50370) Return "M"; Else IF (TMP> = 50371 && TMP < = 50613) Return "N"; Else IF (TMP> = 50614 && TMP <= 50621) Return "O"; ELSE IF (TMP> = 50622 && TMP <= 50905) Return "P"; Else IF (TMP> = 50906 && TMP <= 51386) Return "Q"; ELSE IF (TMP> = 51387 && TMP <= 51445) Return "R"; ELSE IF (TMP> = 51446 && TMP <= 52217) Return "S"; ELSE IF (TMP> = 52218 && TMP <= 52697) Return "T"; ELSE IF (TMP> = 52698 && TMP <= 52979) Return "W";

ELSE IF (TMP> = 52980) Return "X"; ELSE IF (TMP> = 53689 && TMP <= 54480) Return "Y"; Else IF (TMP> = 54481 && TMP <= 62289) Return "Z"; ELSE // If not Chinese, return c.toString ();} ///

// is a double-byte character. /// public static bool istwobyteschar (char chr) {string str = chr.tostring (); // Using Chinese support encoded encode = Encoding.Getencoding ("GB18030"); if (ecode.getbytecount ) == 2) {return true;} else {returnaf false;}}

///

/// gets a character's ASCII code /// public static int getascii (char chr) {encoding ecode = encoding.getencoding ("gb18030"); Byte [] codebytes = ecode.getbytes (chr.tostring ()); if (istwobyteschar (chr)) {// double-bytecode is high-class 256, plus low // This is no symbol, then minus 65536 return (int) codebytes [0] * 256 (int) codebytes [1] - 65536;} else {return (int) codeBytes [0];}

转载请注明原文地址:https://www.9cbs.com/read-51860.html

New Post(0)