快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220
网站建设
移动开发
小程序开发
运维推广
网站推广
网站推广
运维外包
运维外包
网站报价
经典案例
网站知识
关于我们
网站建设知识
十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
汉字获取首字母拼音-创新互联
//获取字典 private Dictionary
LoadPinYin(HttpContext context) { string link = context.Request.QueryString["link"]; Dictionary
dic = new Dictionary
(); DataTable dt = GetData();//获取数据库数据 foreach (DataRow row in dt.Rows) { if (row["idsName"].ToString() == "" || row["idsName"].ToString() == "其它") continue; string pinyin = ChineseCap(row["idsName"].ToString().Substring(0, 1)); if (dic.ContainsKey(pinyin)) { dic[pinyin] += string.Format("
{0}
", clsCommon.leftx(row["idsName"].ToString(), 10), Global.RewriteStaticUrl(link + "?idsid=" + row["idsID"].ToString()), row["idsName"].ToString()); } else { dic.Add(pinyin, string.Format("
{0}
", clsCommon.leftx(row["idsName"].ToString(), 10), Global.RewriteStaticUrl(link + "?idsid=" + row["idsID"].ToString()), row["idsName"].ToString())); } } return dic; } //转换 public string ChineseCap(string ChineseStr) { string Capstr = string.Empty; byte[] ZW = new byte[2]; long ChineseStr_int; string CharStr, ChinaStr = ""; for (int i = 0; i <= ChineseStr.Length - 1; i++) { CharStr = ChineseStr.Substring(i, 1).ToString(); ZW = System.Text.Encoding.Default.GetBytes(CharStr); // 得到汉字符的字节数组 if (ZW.Length == 2) { int i1 = (short)(ZW[0]); int i2 = (short)(ZW[1]); ChineseStr_int = i1 * 256 + i2; if ((ChineseStr_int >= 45217) && (ChineseStr_int <= 45252)) { ChinaStr = "A"; } else if ((ChineseStr_int >= 45253) && (ChineseStr_int <= 45760)) { ChinaStr = "B"; } else if ((ChineseStr_int >= 45761) && (ChineseStr_int <= 46317)) { ChinaStr = "C"; } else if ((ChineseStr_int >= 46318) && (ChineseStr_int <= 46825)) { ChinaStr = "D"; } else if ((ChineseStr_int >= 46826) && (ChineseStr_int <= 47009)) { ChinaStr = "E"; } else if ((ChineseStr_int >= 47010) && (ChineseStr_int <= 47296)) { ChinaStr = "F"; } else if ((ChineseStr_int >= 47297) && (ChineseStr_int <= 47613)) { ChinaStr = "G"; } else if ((ChineseStr_int >= 47614) && (ChineseStr_int <= 48118)) { ChinaStr = "H"; } else if ((ChineseStr_int >= 48119) && (ChineseStr_int <= 49061)) { ChinaStr = "J"; } else if ((ChineseStr_int >= 49062) && (ChineseStr_int <= 49323)) { ChinaStr = "K"; } else if ((ChineseStr_int >= 49324) && (ChineseStr_int <= 49895)) { ChinaStr = "L"; } else if ((ChineseStr_int >= 49896) && (ChineseStr_int <= 50370)) { ChinaStr = "M"; } else if ((ChineseStr_int >= 50371) && (ChineseStr_int <= 50613)) { ChinaStr = "N"; } else if ((ChineseStr_int >= 50614) && (ChineseStr_int <= 50621)) { ChinaStr = "O"; } else if ((ChineseStr_int >= 50622) && (ChineseStr_int <= 50905)) { ChinaStr = "P"; } else if ((ChineseStr_int >= 50906) && (ChineseStr_int <= 51386)) { ChinaStr = "Q"; } else if ((ChineseStr_int >= 51387) && (ChineseStr_int <= 51445)) { ChinaStr = "R"; } else if ((ChineseStr_int >= 51446) && (ChineseStr_int <= 52217)) { ChinaStr = "S"; } else if ((ChineseStr_int >= 52218) && (ChineseStr_int <= 52697)) { ChinaStr = "T"; } else if ((ChineseStr_int >= 52698) && (ChineseStr_int <= 52979)) { ChinaStr = "W"; } else if ((ChineseStr_int >= 52980) && (ChineseStr_int <= 53640)) { ChinaStr = "X"; } else if ((ChineseStr_int >= 53689) && (ChineseStr_int <= 54480)) { ChinaStr = "Y"; } else if ((ChineseStr_int >= 54481) && (ChineseStr_int <= 55289)) { ChinaStr = "Z"; } } else { Capstr = ChineseStr; break; } Capstr = Capstr + ChinaStr; } return Capstr; }
网站题目:汉字获取首字母拼音-创新互联
URL标题:
http://6mz.cn/article/ccccoc.html
其他资讯
html插入css外样式的简单介绍
html5播放器卡 h5播放器卡怎么解决
linux根路径命令 Linux切换路径命令
android文字转图片 android语音转文字开发
包含jQuery链接失效的词条