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;
}
查看全文
相关阅读:
for,while循环嵌套二次练习
break语句;continue语句
实际运用for、while循环嵌套
for,while循环嵌套
while循环
if语法分支
js读取cookie,并利用encrypt和decrypt加密和解密方法
instance of的java用法
objectmapper使用
日志组件slf4j介绍及配置详解
原文地址:https://www.cnblogs.com/acelove/p/304928.html
最新文章
[BUUCTF]REVERSE——刮开有奖
[BUUCTF]REVERSE——Java逆向解密
[BUUCTF]PWN——jarvisoj_fm
[BUUCTF]PWN——[BJDCTF 2nd]r2t4
[BUUCTF]REVERSE——SimpleRev
[BUUCTF]REVERSE——不一样的flag
[BUUCTF]REVERSE——reverse3
vue插槽
vue计算属性
vue组件
热门文章
vue事件
vue条件渲染
vue条件渲染2
列表渲染.html
todoList.html
style.html
元祖
list列表
布尔值
string内建函数
Copyright © 2011-2022 走看看