zoukankan
html css js c++ java
C#中取得汉语拼音首字母
static
public
string
GetChineseSpell(
string
strText)
{
int
len
=
strText.Length;
string
myStr
=
""
;
for
(
int
i
=
0
;i
{
myStr
+=
getSpell(strText.Substring(i,
1
));
}
return
myStr;
}
static
public
string
getSpell(
string
cnChar)
{
byte
[] arrCN
=
Encoding.Default.GetBytes(cnChar);
if
(arrCN.Length
>
1
)
{
int
area
=
(
short
)arrCN[
0
];
int
pos
=
(
short
)arrCN[
1
];
int
code
=
(area
<<
8
)
+
pos;
int
[] areacode
=
{
45217
,
45253
,
45761
,
46318
,
46826
,
47010
,
47297
,
47614
,
48119
,
48119
,
49062
,
49324
,
49896
,
50371
,
50614
,
50622
,
50906
,
51387
,
51446
,
52218
,
52698
,
52698
,
52698
,
52980
,
53689
,
54481
}
;
for
(
int
i
=
0
;i
<
26
;i
++
)
{
int
max
=
55290
;
if
(i
!=
25
) max
=
areacode[i
+
1
];
if
(areacode[i]
<=
code
&&
code
{
return
Encoding.Default.GetString(
new
byte
[]
{(
byte
)(
65
+
i)}
);
}
}
return
"
*
"
;
}
else
return
cnChar;
}
查看全文
相关阅读:
NeurIPS 2018 中的贝叶斯研究
史上最全采样方法详细解读与代码实现
采样方法(二)MCMC相关算法介绍及代码实现
第七十四篇:机器学习优化方法及超参数设置综述
论文阅读:《Bag of Tricks for Efficient Text Classification》
训练技巧详解【含有部分代码】Bag of Tricks for Image Classification with Convolutional Neural Networks
数值分析-Legendre正交多项式 实现函数逼近
指针生成网络(Pointer-Generator-Network)原理与实战
强化学习入门 第五讲 值函数逼近
UniGUI的 TUniPageControl控件动态拖动tabsheet的实现方法
原文地址:https://www.cnblogs.com/acelove/p/304928.html
最新文章
git基于历史commit创建分支
解决 PathVariable annotation was empty on param 0.
mysql索引
MYSQL之You can't specify target table for update in FROM clause解决办法
linux内置软件安装命令
Shell 变量
关于负载均衡的一切:总结与思考
@Mock与@InjectMocks的区别
Git 基础
提高性能,MySQL 读写分离环境搭建(一)
热门文章
SpringMVC-方法四种类型返回值总结,你用过几种?
Spring Boot + Vue 前后端分离,两种文件上传方式总结
MyBatis中主键回填的两种实现方式
SpringMVC 中 @ControllerAdvice 注解的三种使用场景!
一个Java程序猿眼中的前后端分离以及Vue.js入门
Spring Boot 中实现定时任务的两种方式
Spring Boot 中关于自定义异常处理的套路!
Spring Boot 定义系统启动任务,你会几种方式?
你真的理解 Spring Boot 项目中的 parent 吗?
模型汇总24
Copyright © 2011-2022 走看看