输入汉字,得到汉字的大写首字母 输入一串汉字例如:奥林匹克得到:ALPK输入:我爱你得到:WAN高手,请给例子,谢谢~~!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public static 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; }public static string getSpell(string cnChar) { byte[] arrCN = System.Text.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 System.Text.Encoding.Default.GetString(new byte[] { (byte)(65 + i) }); } } return "*"; } else return cnChar; } very good~!!! very good~!!! very good~!!! very good~!!! very good~!!!谢谢~!! OK,搞定了 http://www.pc123.org/html/net/asp_net/200806/16_2039.html 在asp.net(c#)中加入声音 Firefox为什么不支持onblur事件中的event? 怎样将http://localhost:1676/mis变成http://localhost:1676/ 如何显示datagrid查询记录中的第二页内容? 如何使浏览器上的后退按钮无效 赋值不正确!!! 终于升星了,把所有家当拿出来散了(庆祝) 这个函数调用的参数怎么写(菜鸟问题) 怎样在客户端激发JSCRIPT或VBSCRIPT程序? asp.net 在邮件中实现调查表! asp和asp.net整合出现乱码怎么解决 C#的smtp验证发信怎么做?
public static 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;
}
public static string getSpell(string cnChar)
{
byte[] arrCN = System.Text.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 System.Text.Encoding.Default.GetString(new byte[] { (byte)(65 + i) });
}
}
return "*";
}
else return cnChar;
}