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

Reading number is top 10 articles
轻松掌握Ajax.net系列教程六:使用PopupControlExtender_[Asp.Net教程]
在ASP.net中从SQL数据库保存取出图片(可用于上传图片)
PHP爱好者来看:初学者头痛问题汇总_php资料_编程技术
delphi组件VCL类库结构
LINQ可视化查询编辑器-,VLinq_[Asp.Net教程]
ASP.NET,2.0中判断上传的图片是否符合规格_[Asp.Net教程]
探讨SQL,Server,2005.NET,CLR编程_mssql学习_编程技术
解决跨站点XMLHttp请求的一个变通方法_[XML教程]
Delphi图像化的导航界面实例
php5的simplexml解析错误_php资料_编程技术
Reading number is top 10 pictures
做运动的校花2
Absolutely shocked. National geographic 50 animal photographys2
Sora aoi possession of boudoir1
Sexy women in 2013--1
清纯性感的美眉2
Fierce! China's special forces training the devil2
30 beautiful school beauty6
做运动的校花1
Soldier saw beauty after the reaction
黑社会大哥相亲
Download software ranking
天龙八部十二宫服务端
Tram sex maniac 2 (H) rar bag13
天龙八部最新服务端
WebService在.NET中的实战应用教学视频 → 第5集
Prostitutes diary
Ashlynn Video2
The Bermuda triangle1
Boxer's Top ten classic battle9
仙剑奇侠传98硬盘WINXP版
matrix3
delv published in(发表于) 2014/1/24 9:09:29 Edit(编辑)
C#返回汉字的首字母_[Asp.Net教程]

C#返回汉字的首字母_[Asp.Net教程]

C#返回汉字的首字母_[Asp.Net教程]

using System;
using System.Collections.Generic;
using System.Text;


namespace Common
{
class HZ
{
public static string GetPinyin(string HZ)
{
string ret = string.Empty;
for (int i = 0; i < HZ.Length; i++)
{
ret += GetPinyin2(HZ);
}
return ret;
}
public static string GetPinyin2(string HZ)
{
try
{
byte[] ZW = new byte[2];
long HZ_INT;
ZW = System.Text.Encoding.Default.GetBytes(HZ);
// get the array of byte from the single char
//int i1 = (short)(array[0] - oxa1);
//int i2 = (short)(array[1] - oxa1);
if (ZW.Length <= 1)
{
return HZ;
}
int i1 = (short)(ZW[0]);
int i2 = (short)(ZW[1]);
HZ_INT = i1 * 256 + i2; // expresstion
//table of the constant list
// 'A'; //45217..45252
// 'B'; //45253..45760
// 'C'; //45761..46317
// 'D'; //46318..46825
// 'E'; //46826..47009
// 'F'; //47010..47296
// 'G'; //47297..47613


// 'H'; //47614..48118
// 'J'; //48119..49061
// 'K'; //49062..49323
// 'L'; //49324..49895
// 'M'; //49896..50370
// 'N'; //50371..50613
// 'O'; //50614..50621
// 'P'; //50622..50905
// 'Q'; //50906..51386


// 'R'; //51387..51445
// 'S'; //51446..52217
// 'T'; //52218..52697
//没有U,V
// 'W'; //52698..52979
// 'X'; //52980..53640
// 'Y'; //53689..54480
// 'Z'; //54481..55289


// HZ_INT match the constant
if ((HZ_INT >= 45217) && (HZ_INT <= 45252))
{
return "A";
}
if ((HZ_INT >= 45253) && (HZ_INT <= 45760))
{
return "B";
}
if ((HZ_INT >= 45761) && (HZ_INT <= 46317))
{
return "C";


}
if ((HZ_INT >= 46318) && (HZ_INT <= 46825))
{
return "D";
}
if ((HZ_INT >= 46826) && (HZ_INT <= 47009))
{
return "E";
}
if ((HZ_INT >= 47010) && (HZ_INT <= 47296))
{
return "F";
}
if ((HZ_INT >= 47297) && (HZ_INT <= 47613))
{
return "G";
}
//**************************
if ((HZ_INT >= 47614) && (HZ_INT <= 48118))
{
//MessageBox.Show("H");
return "H";
}


if ((HZ_INT >= 48119) && (HZ_INT <= 49061))
{
return "J";
}
if ((HZ_INT >= 49062) && (HZ_INT <= 49323))
{
return "K";
}
if ((HZ_INT >= 49324) && (HZ_INT <= 49895))
{
return "L";
}
if ((HZ_INT >= 49896) && (HZ_INT <= 50370))
{
return "M";
}


if ((HZ_INT >= 50371) && (HZ_INT <= 50613))
{
return "N";


}
if ((HZ_INT >= 50614) && (HZ_INT <= 50621))
{
return "O";
}
if ((HZ_INT >= 50622) && (HZ_INT <= 50905))
{
return "P";


}
if ((HZ_INT >= 50906) && (HZ_INT <= 51386))
{
return "Q";


}
//*********************
if ((HZ_INT >= 51387) && (HZ_INT <= 51445))
{
return "R";
}
if ((HZ_INT >= 51446) && (HZ_INT <= 52217))
{
return "S";
}
if ((HZ_INT >= 52218) && (HZ_INT <= 52697))
{
return "T";
}
if ((HZ_INT >= 52698) && (HZ_INT <= 52979))
{
return "W";
}
if ((HZ_INT >= 52980) && (HZ_INT <= 53640))
{
return "X";
}
if ((HZ_INT >= 53689) && (HZ_INT <= 54480))
{
return "Y";
}
if ((HZ_INT >= 54481) && (HZ_INT <= 55289))
{
return "Z";
}
}
catch
{
}


return ("");
}
}
}


来源:vainnetwork的blog







添加到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.