C#中如何获取汉字的笔画数和汉字的拼音
2024-08-30 09:15:53
以前玩过一个游戏,输入两个人的名字然后点击缘分就能产生一段缘分测试的结果,后来经过分析知道是根据名字笔画数之差来弄的小游戏,于是就在百度上找怎么得到汉字的笔画数,也没找到自己想要的答案,问遍了所有的人也不知道怎么弄的,终于功夫不负有心人找到答案了,现在分享给大家!
第一步:添加DLL文件的引用
DLL下载地址:点此下载
第二步
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.International.Converters.PinYinConverter; namespace Example_CS
{
class Program
{
static void Main(string[] args)
{
ChineseChar chineseChar = new ChineseChar('微');
Console.WriteLine("Stroke number of 微 in Chinese is {0}.", chineseChar.StrokeNumber);
Console.WriteLine("{0} characters' pinyin is \"wei1\".", ChineseChar.GetHomophoneCount("wei1"));
if(ChineseChar.IsHomophone('微', '薇'))
{
Console.WriteLine("微 and 薇 have the same pinyin.");
}
else
{
Console.WriteLine("微 and 薇 have different pinyins.");
}
}
}
}
其中上面的属性和方法中:StrokeNumber属性用来获取字符的笔画数;
Pinyins方法
获取这个字符的拼音。
最新文章
- Python DES 加密解密,就是大家所谓想要的那个非常快速的方法
- Android安全之Https中间人攻击漏洞
- Notes of the scrum meeting(10/31)
- python模块之os和os.path模块
- Calendar - SGU 115(日期判断)
- JavaWeb图表插件的小研究
- Spring实战——Profile
- 消息映射(C++)(转)
- maven的web项目手工发布
- ssh相关命令
- c++中关于值对象与其指针以及const值对象与其指针的问题详细介绍
- js模块加载详解
- RESTful API接口文档规范小坑
- linux yum配置代理
- 【Unity】微软的一款依赖注入组件
- white-space:pre-wrap和word-break:break-all;
- Linux系统挂载Windows的共享文件夹
- Java:foreach实现原理
- kali网卡配置文件
- 在线图标制作,格式转换 ICON
热门文章
- php建立一个空类: stdClass
- go语言之并发编程一
- go语言之接口二
- [转载]Java web应用中的常见字符编码问题的解决方法
- JVM调优-工具篇
- python webserver客户端
- 【TFS】解决TFS编译中文乱码问题
- 什么是gevent
- [原创]java WEB学习笔记39:EL中的运算符号(算术运算符,关系运算符,逻辑运算符,empty运算符,条件运算符,括号运算符)
- [原创]java WEB学习笔记25:MVC案例完整实践(part 6)---新增操作的设计与实现