zoukankan
html css js c++ java
C#中判断字符是否为中文
在unicode 字符串中,中文的范围是在4E00..9FFF:CJK Unified Ideographs。
通过对字符的unicode编码进行判断来确定字符是否为中文。
protected
bool IsChineseLetter
(string input,int index
)
...
{
int
code
=
0
;
int
chfrom
=
Convert.ToInt32(
"
4e00
"
,
16
);
//
范围(0x4e00~0x9fff)转换成int(chfrom~chend)
int
chend
=
Convert.ToInt32(
"
9fff
"
,
16
);
if
(input
!=
""
)
...
{
code
=
Char.ConvertToUtf32(input, index
);
//获得
字符串input中指定索引index处字符unicode编码
if
(code
>=
chfrom
&&
code
<=
chend)
...
{
return true;
//
当code在中文范围内返回true
}
else
...
{
return false ;
//
当code不在中文范围内返回false
}
}
return false;
}
查看全文
相关阅读:
均匀分布
吉布斯采样(Gibbs采样)
蒙特卡罗方法 Monte Carlo method
马尔科夫链
python 3 没有了xrange
%matplotlib inline的含义
MCMC采样和M-H采样
pycharm 安装模块 use the correct version of 'pip' installed for your Python interpreter
Pycharm安装第三方库时出现Read timed out的解决办法
如何在Pycharm中添加新的模块(第三方包)
原文地址:https://www.cnblogs.com/liufei88866/p/1534287.html
最新文章
分数累加
Java获取当前内存及硬盘使用情况
Refrence
【转】大众点评Cat--架构分析
tomcat配置文件context.xml和server.xml分析
git merge origin master git merge origin/master区别
【转】大众点评CAT开源监控系统剖析
解决Mac OS X 系统在home文件夹下面操作不支持的方法
Tomcat性能调优
查看mysql的版本号
热门文章
Java JDBC连接SQL Server2005错误:通过port 1433 连接到主机 localhost 的 TCP/IP 连接失败
关于C++类型检查的一点小挫折
iOS十进制切割格式转换
程序猿生存定律--前言:解码程序人生
大话重构连载16:超级大函数
MFC之菜单
CF 427D Match & Catch 求最短唯一连续LCS
leetcode——169 Majority Element(数组中出现次数过半的元素)
2种冒泡排序优化
CSDN博客的积分计算方法和博客排名规律
Copyright © 2011-2022 走看看