zoukankan
html css js c++ java
c# asp.net 2.0 获取汉字第一个拼音
/**/
///
<summary>
///
获取汉字第一个拼音
///
</summary>
///
<param name="input"></param>
///
<returns></returns>
static
public
string
getSpells(
string
input)
...
{
...
#region
int
len
=
input.Length;
string
reVal
=
""
;
for
(
int
i
=
0
; i
<
len; i
++
)
...
{
reVal
+=
getSpell(input.Substring(i,
1
));
}
return
reVal;
#endregion
}
static
public
string
getSpell(
string
cn)
...
{
...
#region
byte
[] arrCN
=
Encoding.Default.GetBytes(cn);
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
<
max)
...
{
return
Encoding.Default.GetString(
new
byte
[]
...
{ (
byte
)(
65
+
i) }
);
}
}
return
"
?
"
;
}
else
return
cn;
#endregion
}
查看全文
相关阅读:
事件冒泡与捕获
$(this)到底是个啥
监测代码的作用及用法
响应消息的内容类型text/html与绑定的text/xml内容类型不匹配
MySqlConnection using MySql.Data.dll
mysql 导出导入数据库
ORA-06550 PLS-00103:出现符号“DROP”在需要下列之一时:
注册InstallShield Limited Edition for Visual Studio 时无法选择国家解决方法
访问LINQ的结果
WPF TextBox中keydown事件组合键
原文地址:https://www.cnblogs.com/lds85930/p/1207751.html
最新文章
求数组子序列的最大和
【面试】求数组子序列的最大和
记glide框架使用中所遇到的问题
Py小技巧一:在列表,字典,集合中根据条件筛选数据
Python面向对象相关知识1
Python列表的生成
Python迭代dict的value
Python的索引迭代
Linux的文件权限与目录配置
Android5.0新动画之VectorDrawable
热门文章
Lambda表达式在Android开发中的应用
Linux 入门知识一(附上如何解决Ubuntu的root密码问题)
/etc/rc5.d/s991local: line25: eject:command not found错误
调试利器 console
js function中的apply和call的理解
杂七杂八
年底终结
自己对代码编规范的一点心得
滚屏那些事
自己对前端的心得
Copyright © 2011-2022 走看看