获取汉字第一个拼音 c# asp.net 2.0
2007-08-15 16:48
731 查看
/**//// <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
}
相关文章推荐
- c# asp.net 2.0 获取汉字第一个拼音
- ASP.NET 根据汉字获取汉字拼音的首字母(含多音字)
- asp中获取汉字拼音的第一个字母
- asp.net汉字转拼音和获取汉字首字母的代码
- ASP.NET中如何获取汉字的拼音
- ASP.NET获取汉字拼音的首字母
- ASP.NET 根据汉字获取汉字拼音的首字母(含多音字)
- asp.net汉字转拼音和获取汉字首字母的代码
- asp.net 获取汉字字符串的拼音首字母,含多音字
- [Asp.Net WinForm]利用Visual Studio International Pack来获取汉字的拼音缩写
- 取得汉字拼音首字母 (asp.net C#)
- ASP.NET获取汉字拼音的首字母
- ASP.NET汉字转拼音 - 输入汉字获取其拼音的具体实现
- ASP.NET汉字转拼音 - 输入汉字获取其拼音的具体实现
- asp.net 自动将汉字转换成拼音第一个字母
- ASP.NET获取汉字拼音的首字母
- ASP.NET获取汉字拼音的首字母
- asp.net中C#获取字符串中汉字的个数的具体实现方法