汉字转拼音、简体转繁体
Microsoft Visual Studio International Pack 下载地址
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.International.Converters.PinYinConverter; namespace 汉字转换拼音 { class Program { static void Main(string[] args) { //ChineseChar ch = new ChineseChar('墉'); //foreach (var item in ch.Pinyins) //{ // Console.WriteLine(item.Substring(0, item.Length-1)); //} Console.WriteLine("请输入汉字"); string str = Console.ReadLine(); string result = ""; foreach (char item in str) { ChineseChar ch = new ChineseChar(item); result += ch.Pinyins[0].Substring(0, ch.Pinyins[0].Length - 1); } Console.WriteLine(result); Console.ReadKey(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.International.Converters.TraditionalChineseToSimplifiedConverter; namespace 简体转繁体 { class Program { static void Main(string[] args) { //Console.WriteLine(ChineseConverter.Convert("北京時間", ChineseConversionDirection.TraditionalToSimplified)); Console.WriteLine("请输入汉字(简体转繁体)"); string str = Console.ReadLine(); string result = ChineseConverter.Convert(str,ChineseConversionDirection.SimplifiedToTraditional); Console.WriteLine(result); Console.ReadKey(); } } }