漢字轉拼音的類C

2021-08-25 03:54:15 字數 1293 閱讀 5364

漢字轉拼音的類(c#):

///將漢字轉換成為拼音 /// public class chs2py ; private static string pystr = new string; public chs2py() public static string convert(string chrstr) else } } } return returnstr; } }

獲取漢字的首字母的拼音:

/// /// 獲取中文字元的字母字首 /// /// 漢字 /// 拼音首字 public string chinesechartopinyin(string hz) //獲得漢字的區位碼 else if (tmp >= 45253 && tmp <= 45760) else if (tmp >= 45761 && tmp <= 46317) else if (tmp >= 46318 && tmp <= 46825) else if (tmp >= 46826 && tmp <= 47009) else if (tmp >= 47010 && tmp <= 47296) else if (tmp >= 47297 && tmp <= 47613) else if (tmp >= 47614 && tmp <= 48118) else if (tmp >= 48119 && tmp <= 49061) else if (tmp >= 49062 && tmp <= 49323) else if (tmp >= 49324 && tmp <= 49895) else if (tmp >= 49896 && tmp <= 50370) else if (tmp >= 50371 && tmp <= 50613) else if (tmp >= 50614 && tmp <= 50621) else if (tmp >= 50622 && tmp <= 50905) else if (tmp >= 50906 && tmp <= 51386) else if (tmp >= 51387 && tmp <= 51445) else if (tmp >= 51446 && tmp <= 52217) else if (tmp >= 52218 && tmp <= 52697) else if (tmp >= 52698 && tmp <= 52979) else if (tmp >= 52980 && tmp <= 53640) else if (tmp >= 53689 && tmp <= 54480) else if (tmp >= 54481 && tmp <= 55289) return getpychar; } else }

tingsking18

」和主站點

位址,方便其他朋友提問和指正。

漢字轉拼音類

using system using system.collections.generic using system.linq using system.web using system.text using system.text.regularexpressions 定義陣列 private s...

漢字轉拼音類

漢字轉拼音類 輸入的漢字字串統一先轉換為gbk,然後進行拼音轉換,英文和標點符號原樣輸出。utf 8 gbk pinyin utf 8 注 多音字無法識別,轉換漢字為一級漢字3千多個,生僻字不行,字串中個別特殊符號的存在可能造成轉換輸出不正確 class cntopinyin 返回首字母 priva...

漢字轉拼音的類

今天有了個關於漢字相關的想法,會用到拼音,所以就上網搜尋了一下如何將漢字自動轉換為拼音,沒想到還真有,呵呵。把 貼上到這裡吧,大家一起學習。using system using system.collections.generic using system.text using system.tex...