1.应用场景
- 将汉字转换为拼音(eg:"我爱你"———>"WOAINI")
- 取各个汉字的首字母(eg:"我是中国人"———>"WSZGR")
2.涉及到的组件
- 组件1:ToolGood.Words【我实际的就是这种】
- 组件名称:ToolGood.Words
- nuget地址:
- 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.关键代码截图
5.如果有其他好的组件推荐,欢迎各位大佬补充
Asp.net中汉字转换成为拼音
原文地址:https://www.cnblogs.com/yu-yi/p/9488643.html