Chinese characters pinyin and pinyin code acquisition

xiaoxiao2021-03-06  33

Public class classime_spell_code {public classime_spell_code () {}

#Region Chinese characters Pinyin code ///

/// Chinese characters Pinyin code ///

Public static string getime_spell (String strimecha) {string strresult = ";

Try {

For (int i = 0; i

Return strresult;} catch (system.nullreferenceException nullex) {throw Nullex;} catch (exception ex) {throw ex;}}

/ / Here is the first letter public static string extract_hz (string hz) {try {byte [] zw = new byte; zw = system.text.encoding.default.text.Encoding.default.Text.Encoding.default.getbytes (Hz) ; // Get the array of byte from the Single Char if (zw.Length <= 1) {RETURN HZ;} INT I1 = (ZW [0]); INT I2 = (Short) (ZW [1] ); Hz_int = I1 * 256 I2; // Expresstion // Table of the constant list // 'A'; //45217..45252 // 'b'; //45253..45760 // 'c'; //45761..46317 // 'd'; //46318..46825 // 'E'; //46826..47009 // 'f'; //47010..47296 // 'g'; // 47297..47613

// 'h'; //47614..48118 // 'j'; //48119..49061 // 'k'; //49062..49323 // 'L'; //49324..49895 ///// 'M'; //49896..50370 // 'n'; //50371..50613 // 'o'; //50614..50621 // 'p'; //50622..50905 // 'q '; //50906..51386

// 'r'; //51387..51445 // 's'; //51446..52217 // 't'; //52218..52697 // no u, v // 'w'; // 52698..52979 // 'x'; //52980..53640 // 'y'; //53689..54480 // 'z'; ///54481..55289// HZ_INT MATCH THE Constant IF ((hz_int > = 45217) && (HZ_INT <= 45252)) {RETURN "a";} IF (hz_int> = 45253) && (Hz_int <= 45760)) {RETURN "B";} IF ((hz_int> = 45761) && (Hz_INT <= 46317)) {Return "C";

} IF ((hz_int> = 46318) && (hz_int <= 46825)) {RETURN "D";} IF ((Hz_INT> = 46826) && (Hz_int <= 47009)) {Return "E";} IF Hz_INT> = 47010) && (Hz_INT <= 47296)) {RETURN "F";} IF ((hz_int> = 47297) && (Hz_int <= 47613)) {Return "G";} IF ((hz_int> = 47614 ) && (hz_int <= 48118)) {RETURN "H";} IF ((hz_int> = 48119) && (Hz_INT <= 49061)) {Return "J";} IF ((hz_int> = 49062) && (Hz_int <= 49323)) {RETURN "K";} IF ((hz_int> = 49324) && (Hz_INT <= 49895)) {Return "L";} IF ((hz_int> = 49896) && (hz_int <= 50370) ) {Return "m";

IF ((hz_int> = 50371) && (hz_int <= 50613)) {RETURN "N";

} IF (hz_int> = 50614) && (hz_int <= 50621)) {RETURN "O";} IF (hz_int> = 50622) && (hz_int <= 50905)) {RETURN "P";} IF Hz_INT> = 50906) && (hz_int <= 51386)) {RETURN "Q";

} IF ((hz_int> = 51387) && (hz_int <= 51445)) {RETURN "R";} IF ((hz_int> = 51446) && (hz_int <= 52217)) {RETURN "S";} IF Hz_INT> = 52218) && (Hz_int <= 52697)) {RETURN "T";} IF ((hz_int> = 52698) && (hz_int <= 52979)) {return "W";} if ((hz_int> = 52980 ) && (hz_int <= 53640)) {return "x";} IF ((hz_int> = 53689) && (hz_int <= 54480)) {return "y";} if ((hz_int> = 54481) && (hz_int <= 55289)) {Return "Z";} Return "";} catch (system.nullreferenceException nullex) {throw Nullex;} catch (exception ex) {throw ex;}}

// Get Chinese characters Pinyin class classime_spell_full {public classime_spell_full () {}

public const uint IME_REGWORD_STYLE_USER_FIRST = 0x80000000; private string result, srcstring = "character"; public delegate void Mycallback (string lpszReading, uint dwStyle, string lpszString, object o); public Mycallback myc;

[DLLIMPORT ("Imm32.dll")] Public Static Extern Uint ImmenumRegisterWord (Uint HKL, MyCallback LPFNENUMPROC, STRING LPSZREADING, UINT DWSTYLE, STRING LPSZREGISTER, OBJECT O);

// Call this to register word public void ImmCall (string [] args) {myc = new Mycallback (MyCBProc); // callback function is registered, srcstring inside the store to check characters uint x = ImmEnumRegisterWord (0xE00E0804, myc, null, IME_REGWORD_STYLE_USER_FIRST 1, Srcstring, Null;} // Callback function, one pronunciation for each callback back to Chinese characters (String Lpszreading, Uint DWStyle, String Lpszstring, Object O) {Result = lps ...}} # EndRegion

}

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

New Post(0)