• C#汉字生成简拼


    using Microsoft.International.Converters.PinYinConverter;

    //功能:获取汉字字符的每个汉字第一个字符,若是非汉字原样显示出来,需要引用ChnCharInfo.dll文件

    public static string ChineseCharToPingyin(string str) { if (null == str || str.Length <= 0) { return ""; } StringBuilder sb = new StringBuilder(""); ChineseChar chineseChar = null; for (int i = 0; i < str.Length; i++) { try { chineseChar = new ChineseChar(str[i]); if (null != chineseChar.Pinyins[0] && chineseChar.Pinyins[0].Length > 0) sb.Append(chineseChar.Pinyins[0][0]); } catch { sb.Append(str[i]); } } return sb.ToString(); }
  • 相关阅读:
    ATM
    Python不同目录间模块调用
    Python跨目录调程序
    Python软件目录结构规范
    进程的创建-multiprocessing
    进程
    多任务版udp聊天器
    死锁
    互斥锁
    同步
  • 原文地址:https://www.cnblogs.com/joesen/p/2777142.html
Copyright © 2020-2023  润新知