zoukankan
html css js c++ java
得到汉字首字母
Code
1
static
public
string
GetChineseSpell(
string
strText)
2
{
3
int
len
=
strText.Length;
4
string
myStr
=
""
;
5
for
(
int
i
=
0
;i
<
len;i
++
)
6
{
7
myStr
+=
getSpell(strText.Substring(i,
1
));
8
}
9
return
myStr;
10
}
11
12
13
14
static
public
string
getSpell(
string
cnChar)
15
{
16
byte
[] arrCN
=
Encoding.Default.GetBytes(cnChar);
17
if
(arrCN.Length
>
1
)
18
{
19
int
area
=
(
short
)arrCN[
0
];
20
int
pos
=
(
short
)arrCN[
1
];
21
int
code
=
(area
<<
8
)
+
pos;
22
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
}
;
23
for
(
int
i
=
0
;i
<
26
;i
++
)
24
{
25
int
max
=
55290
;
26
if
(i
!=
25
) max
=
areacode[i
+
1
];
27
if
(areacode[i]
<=
code
&&
code
<
max)
28
{
29
return
Encoding.Default.GetString(
new
byte
[]
{(
byte
)(
65
+
i)}
);
30
}
31
}
32
return
"
*
"
;
33
}
34
else
return
cnChar;
35
}
36
查看全文
相关阅读:
使用getopts处理Shell脚本参数
SAP R/3 MM模块学习笔记
应 阿成1 要求 co主要业务操作手册
AIX磁盘管理命令
工作中心和工艺路线
顾问学院培训教材 TAMM ,TAPP,TASD,TACO
十个“三角形”汉字,好看、不好认
ALV做出的报表里更改布局里没有保存按钮的解决方法
SAP系统内的发票校验
修改SAP 登录后的背景图片
原文地址:https://www.cnblogs.com/zhangchenliang/p/1030314.html
最新文章
Asp.net在access下的分页方案
全选 全消 多条记录删除(asp.net)
在ASP.NET中实现图片上传,并按比例生成缩略图
获取GridView中RowCommand的当前选中行的索引或主键Id
ASP.NET安全认证
asp.net中的时间日期选择控件
十大名茶
一个老工程师给年轻工程师的十大忠告
记住该记住的,忘记该忘记的。改变能改变的,接受不能改变的!!
杀人 真心话大冒险 起底
热门文章
世界象一面镜子.
shell 判断字符串是否存在包含关系
html中返回上一页
两个数比较大小
shell求两个数相除后的百分比
用snmp采集系统运行时间
grep使用
shell如何实现 数字 字符串自动补零 awk
ifAdminStatus 和 ifOperStatus 两种状态说明
html中dl dt dd 标签用法与图片列表自动换行
Copyright © 2011-2022 走看看