C # get the first letters of the pinyin of Chinese characters.

xiaoxiao2021-03-06  17

Today, I saw a "C-calculated Chinese Pinya Code" on the YYF9989 blog. I saw the code inside, I feel that it is more cumbersome. It is mainly to retrieve the entered Chinese characters in the array, then return the first letter. So I remembered it, I can use the Chinese characters to the first pinyin of the Chinese characters inside the computer, find some information, successfully solved by the following methods. Let's put it here, please refer to your friends.

Static Public String getCHINESSPELL (Stringstext) {int LEN = strect.length; string mystr = ""; for (int i = 0; i

Static public string getspell (string cnchar) {byte [] arrcn = encoding.default.getbytes (cnchar); if (arrcn.Length> 1) {int area = (short) arrcn [0]; int pos = (short) arrcn [1]; int code = (Area << 8) pos; int [] area = {45217, 45253, 45761, 46318, 46826, 47010, 47297, 47614, 48119, 48119, 49062, 49324, 49896, 50371, 50614, 50622, 50906, 51387, 51446, 52218, 52698, 52698, 52698, 52980, 53689, 54481}; for (INT I = 0; I <26; I ) {INT MAX = 55290; IF (i! = 25 ) Max = area [i 1]; if (AreaCode [i] <= code && code

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

New Post(0)