.Net、C# 汉字转拼音,简体繁体转换方法
1 Microsoft.International.Converters.PinYinConverter.ChineseChar cc=new Microsoft.International.Converters.PinYinConverter.ChineseChar('国');

1 string temp_1 = Microsoft.International.Converters.TraditionalChineseToSimplifiedConverter.ChineseConverter.Convert("中华人民共和国",
2
3 Microsoft.International.Converters.TraditionalChineseToSimplifiedConverter.ChineseConversionDirection.SimplifiedToTraditional);


1 string temp_2 = Microsoft.International.Converters.TraditionalChineseToSimplifiedConverter.ChineseConverter.Convert(temp_1,
2
3 Microsoft.International.Converters.TraditionalChineseToSimplifiedConverter.ChineseConversionDirection.TraditionalToSimplified);

1 1 string temp_4 = string.Format(new Microsoft.International.Formatters.EastAsiaNumericFormatter(), "{0:L}", 1234567890.45);
1 string temp_6 = string.Format(new Microsoft.International.Formatters.EastAsiaNumericFormatter(), "{0:Ln}", 1234567890.45);
1 string temp_7 = string.Format(new Microsoft.International.Formatters.EastAsiaNumericFormatter(), "{0:Lc}", 1234567890.45);
实例代码:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
//简体/繁体切换 string temp_1 = ChineseConverter.Convert("中国人", ChineseConversionDirection.TraditionalToSimplified); string temp_2 = ChineseConverter.Convert("中国人", ChineseConversionDirection.SimplifiedToTraditional); Console.WriteLine("简体转换:"+temp_1+"\n繁体转换:"+temp_2); //汉字转换拼音 string r = string.Empty; Console.Write("请输入任意汉字:"); string str = Console.ReadLine(); foreach (char obj in str) { try { ChineseChar chineseChar = new ChineseChar(obj); string t = chineseChar.Pinyins[0].ToString(); r += t.Substring(0, t.Length - 1); } catch { r += obj.ToString(); } } Console.WriteLine(r.ToLower().ToString()); |
源码:

结果:

.Net、C# 汉字转拼音,简体繁体转换方法的更多相关文章
- c#简体繁体转换
方法一已经亲测,使用正常,方法二貌似不能用. 方法一 /// <summary> /// 中文字符工具类 /// </summary> public static class ...
- 汉字简体繁体转换----Javascript
最近看到有个简体--繁体字互相转换的程序,是用JS实现的,感觉很好玩,所以拿来研究研究.先看看界面如下: 汉字简体繁体转换 // 0&&parent.frames.length) { ...
- 【推荐】iOS汉字转拼音第三方库
PinYin4Objc是一个在git汉字转拼音的开源库,支持简体和繁体中文.效率POAPinyin等其他库要高,转换库也完整下面简单介绍 实现原理 使用unicode_to_hanyu_pinyin. ...
- 最好用的汉字转拼音代码PinYin4Objc(PinYin4J的objc版本)
转:https://github.com/kimziv/PinYin4Objc 最好用的汉字转拼音代码PinYin4Objc(PinYin4J的objc版本)(更新到v1.1.1,增加block异步处 ...
- .NET Core使用微软官方类库实现汉字转拼音
一.NuGet包 拼音:Install-Package SimplifiedChinesePinYinConversion 简体-繁体互转:Install-Package TraditionalChi ...
- PHP 中文工具类,支持汉字转拼音、拼音分词、简繁互转
ChineseUtil 下载地址:https://github.com/Yurunsoft/ChineseUtil 另外一个中文转拼音工具:https://github.com/overtrue/pi ...
- JAVA实现汉字转换为拼音 pinyin4j/JPinyin
在项目中经常会遇到需求用户输入汉字后转换为拼音的场景,比如说通讯录,就会要求按名字首字符发音排序,如果自己写实现这方面的功能是个很好大的工程,还好网上有公开的第三方jar支持转换,结合网上很多前辈的代 ...
- C#中实现输入汉字获取其拼音(汉字转拼音)的2种方法
主要介绍了C#中实现输入汉字获取其拼音(汉字转拼音)的2种方法,本文分别给出了使用微软语言包.手动编码实现两种实现方式,需要的朋友可以参考下 本文刚发布时,只写了一个实现方式,使用的是微软的语言包,但 ...
- iOS 汉字转拼音 PinYin4Objc
PinYin4Objc 是一个效率很高的汉字转拼音类库,支持简体和繁体中文.有以下特性:1.效率高,使用数据缓存,第一次初始化以后,拼音数据存入文件缓存和内存缓存,后面转换效率大大提高:2.支持自定义 ...
随机推荐
- shell脚本查看服务器基本信息
#!/bin/sh #电脑概览 #电脑型号 ComputerModel=`/usr/bin/sudo /usr/sbin/dmidecode | grep -A2 "System Infor ...
- 武汉天喻的NFS 磁盘问题
public void AsyncPaper() { while (true) { try { var jsonText = RedisHelper.BlockPopItemFromList(&quo ...
- json model 互转
1.json转model TestModel tm = new TestModel();JavaScriptSerializer js = new JavaScriptSerializer();tm ...
- codeforces-723D
题目连接:http://codeforces.com/contest/723/problem/D D. Lakes in Berland time limit per test 2 seconds m ...
- 【bzoj3687】【简单题】bitset
[pixiv] https://www.pixiv.net/member_illust.php?mode=medium&illust_id=64333782 这次的图是自己画的,方便的话点个赞 ...
- linux下内存释放问题
参考: http://blog.sina.com.cn/s/blog_3cba7ec10100gk4k.html http://blog.sina.com.cn/s/blog_3cba7ec10100 ...
- xcode 6 exporting ipa 提示 Your account already has a valid iOS distribution certificate 的另一种解决方法
背景: 1. XCode 6.1 2. 证书:develop 证书 3. Scheme 为Device 操作: 在Product - Archive 包过程中,选择Save for Ad hoc De ...
- DOTween教程
参考自DOTween官方文档: DOTween起始上手起来很快,当然前提也是用心看一下哈. > 可以在Unity AssetStore下载得到. 使用方法: 准备: 在导入DOTween后,你需 ...
- 利用【深度网络】高效提取feature
extracting features from a learned model, and add some new features yourself.
- 栅格 CSS中的循环 媒体查询
第三天Bootstrap 模态框 1.要使用模态框,需要现在body里,添加展示模态框的html代码.此时模态框是看不见的 2.如果要显示,$(“.modal”).modal(“show”); 3.如 ...