asp.net字符串判断(Asp.net中汉字转换成为拼音)

1.应用场景
  • 将汉字转换为拼音(eg:"我爱你"———>"WOAINI")
  • 取各个汉字的首字母(eg:"我是中国人"———>"WSZGR")
2.涉及到的组件
  • 组件1:ToolGood.Words【我实际的就是这种】
  1. 组件名称:ToolGood.Words
  2. nuget地址:
  3. github地址【提示:500多个star】
3.关键代码

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ToolGood.Words; namespace PinYinXiangGuan { class Program { static void Main(string[] args) { while (true) { var name = Console.ReadLine(); if (string.IsNullOrEmpty(name)) { break; } //获取汉字的首字母 Console.WriteLine(WordsHelper.GetFirstPinYin(name)); } } } }

4.关键代码截图

asp.net字符串判断(Asp.net中汉字转换成为拼音)(1)

5.如果有其他好的组件推荐,欢迎各位大佬补充,

免责声明:本文仅代表文章作者的个人观点,与本站无关。其原创性、真实性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容文字的真实性、完整性和原创性本站不作任何保证或承诺,请读者仅作参考,并自行核实相关内容。文章投诉邮箱:anhduc.ph@yahoo.com

    分享
    投诉
    首页