All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
ASP.NET技巧:数据导出到Excel最为简易的方法_[Asp.Net教程]
File.Delete不能删除文件的问题_[Asp.Net教程]
asp.net中DataList属性、方法和事件
C#开发里List控件的使用方法介绍_.net资料_编程技术
单击GridView某行获取该行某列内容并显示_[Asp.Net教程]
如何创建SQL Server 2000故障转移群集_[SQL Server教程]
js去除空格trim_JavaScript技术_编程技术
ASP.NET技术中常见问题详细解答及代码_[Asp.Net教程]
C#教程:注册COM+服务组件应用实例
十天学会ASP.net,第二天_.net资料_编程技术
Reading number is top 10 pictures
NeedWallpaper13
上传几张色图
Li Zongrui hunting video screenshots2
Angie Chiu vijara myth1
一个武林高手的故事
西方气质的东方美女2
黑社会大哥相亲
Group of female porn in 《westwards》, uninhibited woman threatened to not the bottom line
Sora aoi possession of boudoir2
Absolutely shocked. National geographic 50 animal photographys4
Download software ranking
Tram sex maniac 2 (H) rar bag5
The Bermuda triangle3
Wild things 2
C++编程教程第三版
I'm come from Beijing1
asp.netWeb服务器高级编程
塘西风月痕
Popkart Cracked versions Mobile phone games
Tram sex maniac 2 (H) rar bag3
尖东毒玫瑰A
归海一刀 published in(发表于) 2014/1/30 1:00:32 Edit(编辑)
ASP.NET获取汉字拼音的首字母_[Asp.Net教程]

ASP.NET获取汉字拼音的首字母_[Asp.Net教程]

ASP.NET获取汉字拼音的首字母_[Asp.Net教程]

#region GetChineseSpell获取汉字拼音的第一个字母
//获取汉字拼音的第一个字母
static public string GetChineseSpell(string strText)
{
int len = strText.Length;
string myStr = "";
for (int i = 0; i < len; i++)
{
myStr += getSpell(strText.Substring(i, 1));
}
return myStr;
}


static public string[] GetChineseSpell(string[] strText)
{
int len = strText.Length;
string[] myStr = null;
for (int i = 0; i < len; i++)
{
myStr[i] = getSpell(strText[i]);
}
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 < max)
{
return Encoding.Default.GetString(new byte[] { (byte)(65 + i) });
}
}
return "*";
}
else return cnChar;
}
#endregion


来源:http://www.cnblogs.com/hakuci







添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.