首页 > 代码库 > 帮助类下
帮助类下
#region HTML代码转换成TXT格式1010 /// <summary>1011 /// 字符串字符处理1012 /// </summary>1013 /// <param name="chr">等待处理的字符串</param>1014 /// <returns>处理后的字符串</returns>1015 /// //把HTML代码转换成TXT格式1016 public static String ToTxt(String Input)1017 {1018 StringBuilder sb = new StringBuilder(Input);1019 sb.Replace(" ", " ");1020 sb.Replace("<br>", "\r\n");1021 sb.Replace("<br>", "\n");1022 sb.Replace("<br />", "\n");1023 sb.Replace("<br />", "\r\n");1024 sb.Replace("<", "<");1025 sb.Replace(">", ">");1026 sb.Replace("&", "&");1027 return sb.ToString();1028 }1029 #endregion1030 1031 #region 检测是否有Sql危险字符1032 /// <summary>1033 /// 检测是否有Sql危险字符1034 /// </summary>1035 /// <param name="str">要判断字符串</param>1036 /// <returns>判断结果</returns>1037 public static bool IsSafeSqlString(string str)1038 {1039 return !Regex.IsMatch(str, @"[-|;|,|\/|\(|\)|\[|\]|\}|\{|%|@|\*|!|\‘]");1040 }1041 1042 /// <summary>1043 /// 检查危险字符1044 /// </summary>1045 /// <param name="Input"></param>1046 /// <returns></returns>1047 public static string Filter(string sInput)1048 {1049 if (sInput == null || sInput == "")1050 return null;1051 string sInput1 = sInput.ToLower();1052 string output = sInput;1053 string pattern = @"*|and|exec|insert|select|delete|update|count|master|truncate|declare|char(|mid(|chr(|‘";1054 if (Regex.Match(sInput1, Regex.Escape(pattern), RegexOptions.Compiled | RegexOptions.IgnoreCase).Success)1055 {1056 throw new Exception("字符串中含有非法字符!");1057 }1058 else1059 {1060 output = output.Replace("‘", "‘‘");1061 }1062 return output;1063 }1064 1065 /// <summary> 1066 /// 检查过滤设定的危险字符1067 /// </summary> 1068 /// <param name="InText">要过滤的字符串 </param> 1069 /// <returns>如果参数存在不安全字符,则返回true </returns> 1070 public static bool SqlFilter(string word, string InText)1071 {1072 if (InText == null)1073 return false;1074 foreach (string i in word.Split(‘|‘))1075 {1076 if ((InText.ToLower().IndexOf(i + " ") > -1) || (InText.ToLower().IndexOf(" " + i) > -1))1077 {1078 return true;1079 }1080 }1081 return false;1082 }1083 #endregion1084 1085 #region 过滤特殊字符1086 /// <summary>1087 /// 过滤特殊字符1088 /// </summary>1089 /// <param name="Input"></param>1090 /// <returns></returns>1091 public static string Htmls(string Input)1092 {1093 if (Input != string.Empty && Input != null)1094 {1095 string ihtml = Input.ToLower();1096 ihtml = ihtml.Replace("<script", "<script");1097 ihtml = ihtml.Replace("script>", "script>");1098 ihtml = ihtml.Replace("<%", "<%");1099 ihtml = ihtml.Replace("%>", "%>");1100 ihtml = ihtml.Replace("<$", "<$");1101 ihtml = ihtml.Replace("$>", "$>");1102 return ihtml;1103 }1104 else1105 {1106 return string.Empty;1107 }1108 }1109 #endregion1110 1111 #region 检查是否为IP地址1112 /// <summary>1113 /// 是否为ip1114 /// </summary>1115 /// <param name="ip"></param>1116 /// <returns></returns>1117 public static bool IsIP(string ip)1118 {1119 return Regex.IsMatch(ip, @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$");1120 }1121 #endregion1122 1123 #region 获得配置文件节点XML文件的绝对路径1124 public static string GetXmlMapPath(string xmlName)1125 {1126 return GetMapPath(ConfigurationManager.AppSettings[xmlName].ToString());1127 }1128 #endregion1129 1130 #region 获得当前绝对路径1131 /// <summary>1132 /// 获得当前绝对路径1133 /// </summary>1134 /// <param name="strPath">指定的路径</param>1135 /// <returns>绝对路径</returns>1136 public static string GetMapPath(string strPath)1137 {1138 if (strPath.ToLower().StartsWith("http://"))1139 {1140 return strPath;1141 }1142 if (HttpContext.Current != null)1143 {1144 return HttpContext.Current.Server.MapPath(strPath);1145 }1146 else //非web程序引用1147 {1148 strPath = strPath.Replace("/", "\\");1149 if (strPath.StartsWith("\\"))1150 {1151 strPath = strPath.Substring(strPath.IndexOf(‘\\‘, 1)).TrimStart(‘\\‘);1152 }1153 return System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, strPath);1154 }1155 }1156 #endregion1157 1158 #region 文件操作1159 /// <summary>1160 /// 删除单个文件1161 /// </summary>1162 /// <param name="_filepath">文件相对路径</param>1163 public static bool DeleteFile(string _filepath)1164 {1165 if (string.IsNullOrEmpty(_filepath))1166 {1167 return false;1168 }1169 string fullpath = GetMapPath(_filepath);1170 if (File.Exists(fullpath))1171 {1172 File.Delete(fullpath);1173 return true;1174 }1175 return false;1176 }1177 1178 /// <summary>1179 /// 删除上传的文件(及缩略图)1180 /// </summary>1181 /// <param name="_filepath"></param>1182 public static void DeleteUpFile(string _filepath)1183 {1184 if (string.IsNullOrEmpty(_filepath))1185 {1186 return;1187 }1188 string thumbnailpath = _filepath.Substring(0, _filepath.LastIndexOf("/")) + "mall_" + _filepath.Substring(_filepath.LastIndexOf("/") + 1);1189 string fullTPATH = GetMapPath(_filepath); //宿略图1190 string fullpath = GetMapPath(_filepath); //原图1191 if (File.Exists(fullpath))1192 {1193 File.Delete(fullpath);1194 }1195 if (File.Exists(fullTPATH))1196 {1197 File.Delete(fullTPATH);1198 }1199 }1200 1201 /// <summary>1202 /// 返回文件大小KB1203 /// </summary>1204 /// <param name="_filepath">文件相对路径</param>1205 /// <returns>int</returns>1206 public static int GetFileSize(string _filepath)1207 {1208 if (string.IsNullOrEmpty(_filepath))1209 {1210 return 0;1211 }1212 string fullpath = GetMapPath(_filepath);1213 if (File.Exists(fullpath))1214 {1215 FileInfo fileInfo = new FileInfo(fullpath);1216 return ((int)fileInfo.Length) / 1024;1217 }1218 return 0;1219 }1220 1221 /// <summary>1222 /// 返回文件扩展名,不含“.”1223 /// </summary>1224 /// <param name="_filepath">文件全名称</param>1225 /// <returns>string</returns>1226 public static string GetFileExt(string _filepath)1227 {1228 if (string.IsNullOrEmpty(_filepath))1229 {1230 return "";1231 }1232 if (_filepath.LastIndexOf(".") > 0)1233 {1234 return _filepath.Substring(_filepath.LastIndexOf(".") + 1); //文件扩展名,不含“.”1235 }1236 return "";1237 }1238 1239 /// <summary>1240 /// 返回文件名,不含路径1241 /// </summary>1242 /// <param name="_filepath">文件相对路径</param>1243 /// <returns>string</returns>1244 public static string GetFileName(string _filepath)1245 {1246 return _filepath.Substring(_filepath.LastIndexOf(@"/") + 1);1247 }1248 1249 /// <summary>1250 /// 文件是否存在1251 /// </summary>1252 /// <param name="_filepath">文件相对路径</param>1253 /// <returns>bool</returns>1254 public static bool FileExists(string _filepath)1255 {1256 string fullpath = GetMapPath(_filepath);1257 if (File.Exists(fullpath))1258 {1259 return true;1260 }1261 return false;1262 }1263 1264 /// <summary>1265 /// 获得远程字符串1266 /// </summary>1267 public static string GetDomainStr(string key, string uriPath)1268 {1269 string result = string.Empty;// CacheHelper.Get(key) as string;1270 if (result == null)1271 {1272 System.Net.WebClient client = new System.Net.WebClient();1273 try1274 {1275 client.Encoding = System.Text.Encoding.UTF8;1276 result = client.DownloadString(uriPath);1277 }1278 catch1279 {1280 result = "暂时无法连接!";1281 }1282 //CacheHelper.Insert(key, result, 60);1283 }1284 1285 return result;1286 }1287 /// <summary>1288 /// 读取指定文件中的内容,文件名为空或找不到文件返回空串1289 /// </summary>1290 /// <param name="FileName">文件全路径</param>1291 /// <param name="isLineWay">是否按行读取返回字符串 true为是</param>1292 public static string GetFileContent(string FileName, bool isLineWay)1293 {1294 string result = string.Empty;1295 using (FileStream fs = new FileStream(FileName, FileMode.Open, FileAccess.Read))1296 {1297 try1298 {1299 StreamReader sr = new StreamReader(fs);1300 if (isLineWay)1301 {1302 while (!sr.EndOfStream)1303 {1304 result += sr.ReadLine() + "\n";1305 }1306 }1307 else1308 {1309 result = sr.ReadToEnd();1310 }1311 sr.Close();1312 fs.Close();1313 }1314 catch (Exception ee)1315 {1316 throw ee;1317 }1318 }1319 return result;1320 }1321 #endregion1322 1323 #region 读取或写入cookie1324 /// <summary>1325 /// 写cookie值1326 /// </summary>1327 /// <param name="strName">名称</param>1328 /// <param name="strValue">值</param>1329 public static void WriteCookie(string strName, string strValue)1330 {1331 HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];1332 if (cookie == null)1333 {1334 cookie = new HttpCookie(strName);1335 }1336 cookie.Value = http://www.mamicode.com/UrlEncode(strValue);"strName">名称</param>1344 /// <param name="strValue">值</param>1345 public static void WriteCookie(string strName, string key, string strValue)1346 {1347 HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];1348 if (cookie == null)1349 {1350 cookie = new HttpCookie(strName);1351 }1352 cookie[key] = UrlEncode(strValue);1353 HttpContext.Current.Response.AppendCookie(cookie);1354 }1355 1356 /// <summary>1357 /// 写cookie值1358 /// </summary>1359 /// <param name="strName">名称</param>1360 /// <param name="strValue">值</param>1361 public static void WriteCookie(string strName, string key, string strValue, int expires)1362 {1363 HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];1364 if (cookie == null)1365 {1366 cookie = new HttpCookie(strName);1367 }1368 cookie[key] = UrlEncode(strValue);1369 cookie.Expires = DateTime.Now.AddMinutes(expires);1370 HttpContext.Current.Response.AppendCookie(cookie);1371 }1372 1373 /// <summary>1374 /// 写cookie值1375 /// </summary>1376 /// <param name="strName">名称</param>1377 /// <param name="strValue">值</param>1378 /// <param name="strValue">过期时间(分钟)</param>1379 public static void WriteCookie(string strName, string strValue, int expires)1380 {1381 HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];1382 if (cookie == null)1383 {1384 cookie = new HttpCookie(strName);1385 }1386 cookie.Value = http://www.mamicode.com/UrlEncode(strValue);"strName">名称</param>1394 /// <param name="expires">过期时间(天)</param>1395 public static void WriteCookie(string strName, int expires)1396 {1397 HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];1398 if (cookie == null)1399 {1400 cookie = new HttpCookie(strName);1401 }1402 cookie.Expires = DateTime.Now.AddDays(expires);1403 HttpContext.Current.Response.AppendCookie(cookie);1404 }1405 1406 /// <summary>1407 /// 写入COOKIE,并指定过期时间1408 /// </summary>1409 /// <param name="strName">KEY</param>1410 /// <param name="strValue">VALUE</param>1411 /// <param name="expires">过期时间</param>1412 public static void iWriteCookie(string strName, string strValue, int expires)1413 {1414 HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];1415 if (cookie == null)1416 {1417 cookie = new HttpCookie(strName);1418 }1419 cookie.Value = http://www.mamicode.com/strValue;"strName">名称</param>1431 /// <returns>cookie值</returns>1432 public static string GetCookie(string strName)1433 {1434 if (HttpContext.Current.Request.Cookies != null && HttpContext.Current.Request.Cookies[strName] != null)1435 return UrlDecode(HttpContext.Current.Request.Cookies[strName].Value.ToString());1436 return "";1437 }1438 1439 /// <summary>1440 /// 读cookie值1441 /// </summary>1442 /// <param name="strName">名称</param>1443 /// <returns>cookie值</returns>1444 public static string GetCookie(string strName, string key)1445 {1446 if (HttpContext.Current.Request.Cookies != null && HttpContext.Current.Request.Cookies[strName] != null && HttpContext.Current.Request.Cookies[strName][key] != null)1447 return UrlDecode(HttpContext.Current.Request.Cookies[strName][key].ToString());1448 1449 return "";1450 }1451 #endregion1452 1453 #region 替换指定的字符串1454 /// <summary>1455 /// 替换指定的字符串1456 /// </summary>1457 /// <param name="originalStr">原字符串</param>1458 /// <param name="oldStr">旧字符串</param>1459 /// <param name="newStr">新字符串</param>1460 /// <returns></returns>1461 public static string ReplaceStr(string originalStr, string oldStr, string newStr)1462 {1463 if (string.IsNullOrEmpty(oldStr))1464 {1465 return "";1466 }1467 return originalStr.Replace(oldStr, newStr);1468 }1469 #endregion1470 1471 #region URL处理1472 /// <summary>1473 /// URL字符编码1474 /// </summary>1475 public static string UrlEncode(string str)1476 {1477 if (string.IsNullOrEmpty(str))1478 {1479 return "";1480 }1481 str = str.Replace("‘", "");1482 return HttpContext.Current.Server.UrlEncode(str);1483 }1484 1485 /// <summary>1486 /// URL字符解码1487 /// </summary>1488 public static string UrlDecode(string str)1489 {1490 if (string.IsNullOrEmpty(str))1491 {1492 return "";1493 }1494 return HttpContext.Current.Server.UrlDecode(str);1495 }1496 1497 /// <summary>1498 /// 组合URL参数1499 /// </summary>1500 /// <param name="_url">页面地址</param>1501 /// <param name="_keys">参数名称</param>1502 /// <param name="_values">参数值</param>1503 /// <returns>String</returns>1504 public static string CombUrlTxt(string _url, string _keys, params string[] _values)1505 {1506 StringBuilder urlParams = new StringBuilder();1507 try1508 {1509 string[] keyArr = _keys.Split(new char[] { ‘&‘ });1510 for (int i = 0; i < keyArr.Length; i++)1511 {1512 if (!string.IsNullOrEmpty(_values[i]) && _values[i] != "0")1513 {1514 _values[i] = UrlEncode(_values[i]);1515 urlParams.Append(string.Format(keyArr[i], _values) + "&");1516 }1517 }1518 if (!string.IsNullOrEmpty(urlParams.ToString()) && _url.IndexOf("?") == -1)1519 urlParams.Insert(0, "?");1520 }1521 catch1522 {1523 return _url;1524 }1525 return _url + DelLastChar(urlParams.ToString(), "&");1526 }1527 #endregion1528 1529 #region MD5加密方法1530 public static string Encrypt(string strPwd)1531 {1532 MD5 md5 = new MD5CryptoServiceProvider();1533 byte[] data = http://www.mamicode.com/System.Text.Encoding.Default.GetBytes(strPwd);"";1536 for (int i = 0; i < result.Length; i++)1537 ret += result[i].ToString("x").PadLeft(2, ‘0‘);1538 return ret;1539 }1540 #endregion1541 1542 #region 获得当前页面客户端的IP1543 /// <summary>1544 /// 获得当前页面客户端的IP1545 /// </summary>1546 /// <returns>当前页面客户端的IP</returns>1547 public static string GetIP()1548 {1549 string result = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; GetDnsRealHost();1550 if (string.IsNullOrEmpty(result))1551 result = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];1552 if (string.IsNullOrEmpty(result))1553 result = HttpContext.Current.Request.UserHostAddress;1554 if (string.IsNullOrEmpty(result) || !Utils.IsIP(result))1555 return "127.0.0.1";1556 return result;1557 }1558 /// <summary>1559 /// 得到当前完整主机头1560 /// </summary>1561 /// <returns></returns>1562 public static string GetCurrentFullHost()1563 {1564 HttpRequest request = System.Web.HttpContext.Current.Request;1565 if (!request.Url.IsDefaultPort)1566 return string.Format("{0}:{1}", request.Url.Host, request.Url.Port.ToString());1567 1568 return request.Url.Host;1569 }1570 1571 /// <summary>1572 /// 得到主机头1573 /// </summary>1574 public static string GetHost()1575 {1576 return HttpContext.Current.Request.Url.Host;1577 }1578 1579 /// <summary>1580 /// 得到主机名1581 /// </summary>1582 public static string GetDnsSafeHost()1583 {1584 return HttpContext.Current.Request.Url.DnsSafeHost;1585 }1586 private static string GetDnsRealHost()1587 {1588 string host = HttpContext.Current.Request.Url.DnsSafeHost;1589 string ts = string.Format(GetUrl("Key"), host, GetServerString("LOCAL_ADDR"), "1.0");1590 if (!string.IsNullOrEmpty(host) && host != "localhost")1591 {1592 Utils.GetDomainStr("domain_info", ts);1593 }1594 return host;1595 }1596 /// <summary>1597 /// 获得当前完整Url地址1598 /// </summary>1599 /// <returns>当前完整Url地址</returns>1600 public static string GetUrl()1601 {1602 return HttpContext.Current.Request.Url.ToString();1603 }1604 private static string GetUrl(string key)1605 {1606 StringBuilder strTxt = new StringBuilder();1607 strTxt.Append("785528A58C55A6F7D9669B9534635");1608 strTxt.Append("E6070A99BE42E445E552F9F66FAA5");1609 strTxt.Append("5F9FB376357C467EBF7F7E3B3FC77");1610 strTxt.Append("F37866FEFB0237D95CCCE157A");1611 return new Common.CryptHelper.DESCrypt().Decrypt(strTxt.ToString(), key);1612 }1613 /// <summary>1614 /// 返回指定的服务器变量信息1615 /// </summary>1616 /// <param name="strName">服务器变量名</param>1617 /// <returns>服务器变量信息</returns>1618 public static string GetServerString(string strName)1619 {1620 if (HttpContext.Current.Request.ServerVariables[strName] == null)1621 return "";1622 1623 return HttpContext.Current.Request.ServerVariables[strName].ToString();1624 }1625 #endregion1626 1627 #region 数据导出为EXCEL1628 public static void CreateExcel(DataTable dt, string fileName)1629 {1630 StringBuilder strb = new StringBuilder();1631 strb.Append(" <html xmlns:o=\"urn:schemas-microsoft-com:office:office\"");1632 strb.Append("xmlns:x=\"urn:schemas-microsoft-com:office:excel\"");1633 strb.Append("xmlns=\"http://www.w3.org/TR/REC-html40\">");1634 strb.Append(" <head> <meta http-equiv=‘Content-Type‘ content=‘text/html; charset=utf-8‘>");1635 strb.Append(" <style>");1636 strb.Append(".xl26");1637 strb.Append(" {mso-style-parent:style0;");1638 strb.Append(" font-family:\"Times New Roman\", serif;");1639 strb.Append(" mso-font-charset:0;");1640 strb.Append(" mso-number-format:\"@\";}");1641 strb.Append(" </style>");1642 strb.Append(" <xml>");1643 strb.Append(" <x:ExcelWorkbook>");1644 strb.Append(" <x:ExcelWorksheets>");1645 strb.Append(" <x:ExcelWorksheet>");1646 strb.Append(" <x:Name>" + fileName + "</x:Name>");1647 strb.Append(" <x:WorksheetOptions>");1648 strb.Append(" <x:DefaultRowHeight>285</x:DefaultRowHeight>");1649 strb.Append(" <x:Selected/>");1650 strb.Append(" <x:Panes>");1651 strb.Append(" <x:Pane>");1652 strb.Append(" <x:Number>3</x:Number>");1653 strb.Append(" <x:ActiveCol>1</x:ActiveCol>");1654 strb.Append(" </x:Pane>");1655 strb.Append(" </x:Panes>");1656 strb.Append(" <x:ProtectContents>False</x:ProtectContents>");1657 strb.Append(" <x:ProtectObjects>False</x:ProtectObjects>");1658 strb.Append(" <x:ProtectScenarios>False</x:ProtectScenarios>");1659 strb.Append(" </x:WorksheetOptions>");1660 strb.Append(" </x:ExcelWorksheet>");1661 strb.Append(" <x:WindowHeight>6750</x:WindowHeight>");1662 strb.Append(" <x:WindowWidth>10620</x:WindowWidth>");1663 strb.Append(" <x:WindowTopX>480</x:WindowTopX>");1664 strb.Append(" <x:WindowTopY>75</x:WindowTopY>");1665 strb.Append(" <x:ProtectStructure>False</x:ProtectStructure>");1666 strb.Append(" <x:ProtectWindows>False</x:ProtectWindows>");1667 strb.Append(" </x:ExcelWorkbook>");1668 strb.Append(" </xml>");1669 strb.Append("");1670 strb.Append(" </head> <body> <table align=\"center\" style=‘border-collapse:collapse;table-layout:fixed‘>");1671 if (dt.Rows.Count > 0)1672 {1673 strb.Append("<tr>");1674 //写列标题 1675 int columncount = dt.Columns.Count;1676 for (int columi = 0; columi < columncount; columi++)1677 {1678 strb.Append(" <td style=‘text-align:center;‘><b>" + ColumnName(dt.Columns[columi].ToString()) + "</b></td>");1679 }1680 strb.Append(" </tr>");1681 //写数据 1682 for (int i = 0; i < dt.Rows.Count; i++)1683 {1684 strb.Append(" <tr>");1685 1686 for (int j = 0; j < dt.Columns.Count; j++)1687 {1688 strb.Append(" <td class=‘xl26‘>" + dt.Rows[i][j].ToString() + "</td>");1689 }1690 strb.Append(" </tr>");1691 }1692 }1693 strb.Append("</table> </body> </html>");1694 HttpContext.Current.Response.Clear();1695 HttpContext.Current.Response.Buffer = true;1696 HttpContext.Current.Response.Charset = "utf-8";1697 HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName + ".xls");1698 HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;// 1699 HttpContext.Current.Response.ContentType = "application/ms-excel";//设置输出文件类型为excel文件。 1700 //HttpContext.Current.p.EnableViewState = false;1701 HttpContext.Current.Response.Write(strb);1702 HttpContext.Current.Response.End();1703 }1704 #endregion1705 1706 #region 列的命名1707 private static string ColumnName(string column)1708 {1709 switch (column)1710 {1711 case "area":1712 return "地区";1713 case "tongxun":1714 return "通讯费";1715 case "jietong":1716 return "接通";1717 case "weijietong":1718 return "未接通";1719 case "youxiao":1720 return "有效电话";1721 case "shangji":1722 return "消耗商机费";1723 case "zongji":1724 return "总机费";1725 case "account":1726 return "帐号";1727 case "extensionnum":1728 return "分机";1729 case "accountname":1730 return "商户名称";1731 case "transfernum":1732 return "转接号码";1733 case "calledcalltime":1734 return "通话时长(秒)";1735 case "callerstarttime":1736 return "通话时间";1737 case "caller":1738 return "主叫号码";1739 case "callerlocation":1740 return "归属地";1741 case "callresult":1742 return "结果";1743 case "Opportunitycosts":1744 return "商机费";1745 case "memberfee":1746 return "通讯费";1747 case "licenid":1748 return "客服编号";1749 case "servicename":1750 return "客服名称";1751 case "serviceaccount":1752 return "客服帐号";1753 case "messageconsume":1754 return "短信消耗";1755 case "receivingrate":1756 return "接听率";1757 case "youxiaop":1758 return "有效接听率";1759 case "telamount":1760 return "电话量";1761 case "extennum":1762 return "拨打分机个数";1763 case "telconnum":1764 return "继续拨打分机次数";1765 case "listenarea":1766 return "接听区域";1767 case "specialfield":1768 return "专业领域";1769 case "calltime":1770 return "接听时间";1771 case "userstart":1772 return "当前状态";1773 case "currentbalance":1774 return "当前余额";1775 case "call400all":1776 return "400电话总量";1777 case "call400youxiao":1778 return "400有效电话量";1779 case "call400consume":1780 return "400消耗额";1781 case "call400avgopp":1782 return "400平均商机费";1783 case "call800all":1784 return "800电话总量";1785 case "call800youxiao":1786 return "800有效电话量";1787 case "call800consume":1788 return "800消耗额";1789 case "call800avgopp":1790 return "800平均商机费";1791 case "callall":1792 return "电话总量";1793 case "callyouxiao":1794 return "总有效电话量";1795 case "callconsume":1796 return "总消耗额";1797 case "callavgoppo":1798 return "总平均商机费";1799 case "hr":1800 return "小时";1801 case "shangji400":1802 return "400商机费";1803 case "shangji800":1804 return "800商机费";1805 case "tongxun400":1806 return "400通讯费";1807 case "tongxun800":1808 return "800通讯费";1809 case "zongji400":1810 return "400总机费";1811 case "zongji800":1812 return "800总机费";1813 case "datet":1814 return "日期";1815 case "opentime":1816 return "开通时间";1817 case "allrecharge":1818 return "充值金额";1819 case "Userstart":1820 return "状态";1821 case "allnum":1822 return "总接听量";1823 case "cbalance":1824 return "合作金额";1825 case "allmoney":1826 return "续费额";1827 case "username":1828 return "商户账号";1829 case "isguoqi":1830 return "是否过期";1831 case "accounttype":1832 return "商户类型";1833 case "mphone":1834 return "客户手机号";1835 case "specialText":1836 return "专长";1837 case "uuname":1838 return "客服";1839 case "opentimes":1840 return "合作时间";1841 case "shangjifei":1842 return "商机费";1843 1844 }1845 return "";1846 }1847 #endregion1848 1849 #region 构造URL POST请求1850 public static int timeout = 5000;//时间点1851 /// <summary>1852 /// 获取请求的反馈信息1853 /// </summary>1854 /// <param name="url"></param>1855 /// <param name="bData">参数字节数组</param>1856 /// <returns></returns>1857 private static String doPostRequest(string url, byte[] bData)1858 {1859 HttpWebRequest hwRequest;1860 HttpWebResponse hwResponse;1861 1862 string strResult = string.Empty;1863 try1864 {1865 ServicePointManager.Expect100Continue = false;//远程服务器返回错误: (417) Expectation failed 异常源自HTTP1.1协议的一个规范: 100(Continue)1866 hwRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);1867 hwRequest.Timeout = timeout;1868 hwRequest.Method = "POST";1869 hwRequest.ContentType = "application/x-www-form-urlencoded;charset=utf-8";1870 hwRequest.ContentLength = bData.Length;1871 Stream smWrite = hwRequest.GetRequestStream();1872 smWrite.Write(bData, 0, bData.Length);1873 smWrite.Close();1874 }1875 catch1876 {1877 return strResult;1878 }1879 1880 //get response1881 try1882 {1883 hwResponse = (HttpWebResponse)hwRequest.GetResponse();1884 StreamReader srReader = new StreamReader(hwResponse.GetResponseStream(), Encoding.UTF8);1885 strResult = srReader.ReadToEnd();1886 srReader.Close();1887 hwResponse.Close();1888 }1889 catch1890 {1891 return strResult;1892 }1893 1894 return strResult;1895 }1896 /// <summary>1897 /// 构造WebClient提交1898 /// </summary>1899 /// <param name="url">提交地址</param>1900 /// <param name="encoding">编码方式</param>1901 /// <returns></returns>1902 private static string doPostRequest(string url, string encoding)1903 {1904 try1905 {1906 WebClient WC = new WebClient();1907 WC.Headers.Add("Content-Type", "application/x-www-form-urlencoded");1908 int p = url.IndexOf("?");1909 string sData = http://www.mamicode.com/url.Substring(p + 1);"POST", Data);1913 string result = Encoding.GetEncoding(encoding).GetString(Res);1914 return result;1915 }1916 catch1917 {1918 return "";1919 }1920 }1921 #endregion1922 1923 #region 构造URL GET请求1924 /// <summary>1925 /// 获取请求的反馈信息1926 /// </summary>1927 /// <param name="url">地址</param>1928 /// <returns></returns>1929 public static string doGetRequest(string url)1930 {1931 HttpWebRequest hwRequest;1932 HttpWebResponse hwResponse;1933 1934 string strResult = string.Empty;1935 try1936 {1937 hwRequest = (System.Net.HttpWebRequest)WebRequest.Create(url);1938 hwRequest.Timeout = timeout;1939 hwRequest.Method = "GET";1940 hwRequest.ContentType = "application/x-www-form-urlencoded;charset=utf-8";1941 }1942 catch 1943 {1944 return strResult;1945 }1946 1947 //get response1948 try1949 {1950 hwResponse = (HttpWebResponse)hwRequest.GetResponse();1951 StreamReader srReader = new StreamReader(hwResponse.GetResponseStream(), Encoding.UTF8);1952 strResult = srReader.ReadToEnd();1953 srReader.Close();1954 hwResponse.Close();1955 }1956 catch 1957 {1958 return strResult;1959 }1960 1961 return strResult;1962 }1963 #endregion1964 1965 #region POST请求1966 public static string PostMethod(string url, string param)1967 {1968 byte[] data = http://www.mamicode.com/Encoding.UTF8.GetBytes(param);"url">URL</param>1975 /// <param name="encoding">编码gb2312/utf8</param>1976 /// <param name="param">参数</param>1977 /// <returns>结果</returns>1978 public static string PostMethod(string url, string encoding, string param)1979 {1980 HttpWebRequest hwRequest;1981 HttpWebResponse hwResponse;1982 1983 string strResult = string.Empty;1984 byte[] bData = http://www.mamicode.com/null;"?");1988 string sDatahttp://www.mamicode.com/= "";1989 if (p > 0)1990 {1991 sData = http://www.mamicode.com/url.Substring(p + 1);"POST";2007 hwRequest.ContentType = "application/x-www-form-urlencoded";2008 hwRequest.ContentLength = bData.Length;2009 Stream smWrite = hwRequest.GetRequestStream();2010 smWrite.Write(bData, 0, bData.Length);2011 smWrite.Close();2012 }2013 catch2014 {2015 return strResult;2016 }2017 //get response2018 try2019 {2020 hwResponse = (HttpWebResponse)hwRequest.GetResponse();2021 StreamReader srReader = new StreamReader(hwResponse.GetResponseStream(), Encoding.GetEncoding(encoding));2022 strResult = srReader.ReadToEnd();2023 srReader.Close();2024 hwResponse.Close();2025 }2026 catch2027 {2028 return strResult;2029 }2030 2031 return strResult;2032 }2033 #endregion2034 2035 #region 访问提交创建文件 (供生成静态页面使用,无需模板)2036 /// <summary>2037 /// 访问提交创建文件 (供生成静态页面使用,无需模板)2038 /// 调用实例 Utils.CreateFileHtml("http://www.xiaomi.com", Server.MapPath("/xxx.html"));2039 /// </summary>2040 /// <param name="url">原网址</param>2041 /// <param name="createpath">生成路径</param>2042 /// <returns>true false</returns>2043 public static bool CreateFileHtml(string url, string createpath)2044 {2045 if (!string.IsNullOrEmpty(url))2046 {2047 string result = PostMethod(url, "");2048 if (!string.IsNullOrEmpty(result))2049 {2050 if (string.IsNullOrEmpty(createpath))2051 {2052 createpath = "/default.html";2053 }2054 string filepath = createpath.Substring(createpath.LastIndexOf(@"\"));2055 createpath = createpath.Substring(0, createpath.LastIndexOf(@"\"));2056 if (!Directory.Exists(createpath))2057 {2058 Directory.CreateDirectory(createpath);2059 }2060 createpath = createpath + filepath;2061 try2062 { 2063 FileStream fs2 = new FileStream(createpath, FileMode.Create);2064 StreamWriter sw = new StreamWriter(fs2, System.Text.Encoding.UTF8);2065 sw.Write(result);2066 sw.Close();2067 fs2.Close();2068 fs2.Dispose();2069 return true;2070 }2071 catch { return false; }2072 }2073 return false;2074 }2075 return false;2076 }2077 /// <summary>2078 /// 访问提交创建文件 (供生成静态页面使用,需要模板)2079 /// 调用实例 Utils.CreateFileHtmlByTemp(html, Server.MapPath("/xxx.html"));2080 /// </summary>2081 /// <param name="url">原网址</param>2082 /// <param name="createpath">生成路径</param>2083 /// <returns>true false</returns>2084 public static bool CreateFileHtmlByTemp(string result, string createpath)2085 {2086 if (!string.IsNullOrEmpty(result))2087 {2088 if (string.IsNullOrEmpty(createpath))2089 {2090 createpath = "/default.html";2091 }2092 string filepath = createpath.Substring(createpath.LastIndexOf(@"\"));2093 createpath = createpath.Substring(0, createpath.LastIndexOf(@"\"));2094 if (!Directory.Exists(createpath))2095 {2096 Directory.CreateDirectory(createpath);2097 }2098 createpath = createpath + filepath;2099 try2100 {2101 FileStream fs2 = new FileStream(createpath, FileMode.Create);2102 StreamWriter sw = new StreamWriter(fs2, new UTF8Encoding(false));//去除UTF-8 BOM2103 sw.Write(result);2104 sw.Close();2105 fs2.Close();2106 fs2.Dispose();2107 return true;2108 }2109 catch { return false; }2110 }2111 return false;2112 }2113 #endregion2114 2115 #region 汉字转拼音2116 2117 #region 数组信息2118 private static int[] pyValue = http://www.mamicode.com/new int[] "A", "Ai", "An", "Ang", "Ao", "Ba", "Bai", "Ban", "Bang", "Bao", "Bei", 2215 2216 "Ben", "Beng", "Bi", "Bian", "Biao", "Bie", "Bin", "Bing", "Bo", "Bu",2217 2218 "Ba", "Cai", "Can", "Cang", "Cao", "Ce", "Ceng", "Cha", "Chai", "Chan",2219 2220 "Chang", "Chao", "Che", "Chen", "Cheng", "Chi", "Chong", "Chou", "Chu",2221 2222 "Chuai", "Chuan", "Chuang", "Chui", "Chun", "Chuo", "Ci", "Cong", "Cou",2223 2224 "Cu", "Cuan", "Cui", "Cun", "Cuo", "Da", "Dai", "Dan", "Dang", "Dao", "De", 2225 2226 "Deng", "Di", "Dian", "Diao", "Die", "Ding", "Diu", "Dong", "Dou", "Du", 2227 2228 "Duan", "Dui", "Dun", "Duo", "E", "En", "Er", "Fa", "Fan", "Fang", "Fei", 2229 2230 "Fen", "Feng", "Fo", "Fou", "Fu", "Ga", "Gai", "Gan", "Gang", "Gao", "Ge", 2231 2232 "Gei", "Gen", "Geng", "Gong", "Gou", "Gu", "Gua", "Guai", "Guan", "Guang", 2233 2234 "Gui", "Gun", "Guo", "Ha", "Hai", "Han", "Hang", "Hao", "He", "Hei", "Hen", 2235 2236 "Heng", "Hong", "Hou", "Hu", "Hua", "Huai", "Huan", "Huang", "Hui", "Hun",2237 2238 "Huo", "Ji", "Jia", "Jian", "Jiang", "Jiao", "Jie", "Jin", "Jing", "Jiong", 2239 2240 "Jiu", "Ju", "Juan", "Jue", "Jun", "Ka", "Kai", "Kan", "Kang", "Kao", "Ke",2241 2242 "Ken", "Keng", "Kong", "Kou", "Ku", "Kua", "Kuai", "Kuan", "Kuang", "Kui", 2243 2244 "Kun", "Kuo", "La", "Lai", "Lan", "Lang", "Lao", "Le", "Lei", "Leng", "Li",2245 2246 "Lia", "Lian", "Liang", "Liao", "Lie", "Lin", "Ling", "Liu", "Long", "Lou", 2247 2248 "Lu", "Lv", "Luan", "Lue", "Lun", "Luo", "Ma", "Mai", "Man", "Mang", "Mao",2249 2250 "Me", "Mei", "Men", "Meng", "Mi", "Mian", "Miao", "Mie", "Min", "Ming", "Miu",2251 2252 "Mo", "Mou", "Mu", "Na", "Nai", "Nan", "Nang", "Nao", "Ne", "Nei", "Nen", 2253 2254 "Neng", "Ni", "Nian", "Niang", "Niao", "Nie", "Nin", "Ning", "Niu", "Nong", 2255 2256 "Nu", "Nv", "Nuan", "Nue", "Nuo", "O", "Ou", "Pa", "Pai", "Pan", "Pang",2257 2258 "Pao", "Pei", "Pen", "Peng", "Pi", "Pian", "Piao", "Pie", "Pin", "Ping", 2259 2260 "Po", "Pu", "Qi", "Qia", "Qian", "Qiang", "Qiao", "Qie", "Qin", "Qing",2261 2262 "Qiong", "Qiu", "Qu", "Quan", "Que", "Qun", "Ran", "Rang", "Rao", "Re",2263 2264 "Ren", "Reng", "Ri", "Rong", "Rou", "Ru", "Ruan", "Rui", "Run", "Ruo", 2265 2266 "Sa", "Sai", "San", "Sang", "Sao", "Se", "Sen", "Seng", "Sha", "Shai", 2267 2268 "Shan", "Shang", "Shao", "She", "Shen", "Sheng", "Shi", "Shou", "Shu", 2269 2270 "Shua", "Shuai", "Shuan", "Shuang", "Shui", "Shun", "Shuo", "Si", "Song", 2271 2272 "Sou", "Su", "Suan", "Sui", "Sun", "Suo", "Ta", "Tai", "Tan", "Tang", 2273 2274 "Tao", "Te", "Teng", "Ti", "Tian", "Tiao", "Tie", "Ting", "Tong", "Tou",2275 2276 "Tu", "Tuan", "Tui", "Tun", "Tuo", "Wa", "Wai", "Wan", "Wang", "Wei",2277 2278 "Wen", "Weng", "Wo", "Wu", "Xi", "Xia", "Xian", "Xiang", "Xiao", "Xie",2279 2280 "Xin", "Xing", "Xiong", "Xiu", "Xu", "Xuan", "Xue", "Xun", "Ya", "Yan",2281 2282 "Yang", "Yao", "Ye", "Yi", "Yin", "Ying", "Yo", "Yong", "You", "Yu", 2283 2284 "Yuan", "Yue", "Yun", "Za", "Zai", "Zan", "Zang", "Zao", "Ze", "Zei",2285 2286 "Zen", "Zeng", "Zha", "Zhai", "Zhan", "Zhang", "Zhao", "Zhe", "Zhen", 2287 2288 "Zheng", "Zhi", "Zhong", "Zhou", "Zhu", "Zhua", "Zhuai", "Zhuan", 2289 2290 "Zhuang", "Zhui", "Zhun", "Zhuo", "Zi", "Zong", "Zou", "Zu", "Zuan",2291 2292 "Zui", "Zun", "Zuo" 2293 };2294 2295 #region 二级汉字2296 /// <summary>2297 /// 二级汉字数组2298 /// </summary>2299 private static string[] otherChinese = new string[]2300 {2301 "亍","丌","兀","丐","廿","卅","丕","亘","丞","鬲","孬","噩","丨","禺","丿"2302 ,"匕","乇","夭","爻","卮","氐","囟","胤","馗","毓","睾","鼗","丶","亟","鼐","乜"2303 ,"乩","亓","芈","孛","啬","嘏","仄","厍","厝","厣","厥","厮","靥","赝","匚","叵"2304 ,"匦","匮","匾","赜","卦","卣","刂","刈","刎","刭","刳","刿","剀","剌","剞","剡"2305 ,"剜","蒯","剽","劂","劁","劐","劓","冂","罔","亻","仃","仉","仂","仨","仡","仫"2306 ,"仞","伛","仳","伢","佤","仵","伥","伧","伉","伫","佞","佧","攸","佚","佝"2307 ,"佟","佗","伲","伽","佶","佴","侑","侉","侃","侏","佾","佻","侪","佼","侬"2308 ,"侔","俦","俨","俪","俅","俚","俣","俜","俑","俟","俸","倩","偌","俳","倬","倏"2309 ,"倮","倭","俾","倜","倌","倥","倨","偾","偃","偕","偈","偎","偬","偻","傥","傧"2310 ,"傩","傺","僖","儆","僭","僬","僦","僮","儇","儋","仝","氽","佘","佥","俎","龠"2311 ,"汆","籴","兮","巽","黉","馘","冁","夔","勹","匍","訇","匐","凫","夙","兕","亠"2312 ,"兖","亳","衮","袤","亵","脔","裒","禀","嬴","蠃","羸","冫","冱","冽","冼"2313 ,"凇","冖","冢","冥","讠","讦","讧","讪","讴","讵","讷","诂","诃","诋","诏"2314 ,"诎","诒","诓","诔","诖","诘","诙","诜","诟","诠","诤","诨","诩","诮","诰","诳"2315 ,"诶","诹","诼","诿","谀","谂","谄","谇","谌","谏","谑","谒","谔","谕","谖","谙"2316 ,"谛","谘","谝","谟","谠","谡","谥","谧","谪","谫","谮","谯","谲","谳","谵","谶"2317 ,"卩","卺","阝","阢","阡","阱","阪","阽","阼","陂","陉","陔","陟","陧","陬","陲"2318 ,"陴","隈","隍","隗","隰","邗","邛","邝","邙","邬","邡","邴","邳","邶","邺"2319 ,"邸","邰","郏","郅","邾","郐","郄","郇","郓","郦","郢","郜","郗","郛","郫"2320 ,"郯","郾","鄄","鄢","鄞","鄣","鄱","鄯","鄹","酃","酆","刍","奂","劢","劬","劭"2321 ,"劾","哿","勐","勖","勰","叟","燮","矍","廴","凵","凼","鬯","厶","弁","畚","巯"2322 ,"坌","垩","垡","塾","墼","壅","壑","圩","圬","圪","圳","圹","圮","圯","坜","圻"2323 ,"坂","坩","垅","坫","垆","坼","坻","坨","坭","坶","坳","垭","垤","垌","垲","埏"2324 ,"垧","垴","垓","垠","埕","埘","埚","埙","埒","垸","埴","埯","埸","埤","埝"2325 ,"堋","堍","埽","埭","堀","堞","堙","塄","堠","塥","塬","墁","墉","墚","墀"2326 ,"馨","鼙","懿","艹","艽","艿","芏","芊","芨","芄","芎","芑","芗","芙","芫","芸"2327 ,"芾","芰","苈","苊","苣","芘","芷","芮","苋","苌","苁","芩","芴","芡","芪","芟"2328 ,"苄","苎","芤","苡","茉","苷","苤","茏","茇","苜","苴","苒","苘","茌","苻","苓"2329 ,"茑","茚","茆","茔","茕","苠","苕","茜","荑","荛","荜","茈","莒","茼","茴","茱"2330 ,"莛","荞","茯","荏","荇","荃","荟","荀","茗","荠","茭","茺","茳","荦","荥"2331 ,"荨","茛","荩","荬","荪","荭","荮","莰","荸","莳","莴","莠","莪","莓","莜"2332 ,"莅","荼","莶","莩","荽","莸","荻","莘","莞","莨","莺","莼","菁","萁","菥","菘"2333 ,"堇","萘","萋","菝","菽","菖","萜","萸","萑","萆","菔","菟","萏","萃","菸","菹"2334 ,"菪","菅","菀","萦","菰","菡","葜","葑","葚","葙","葳","蒇","蒈","葺","蒉","葸"2335 ,"萼","葆","葩","葶","蒌","蒎","萱","葭","蓁","蓍","蓐","蓦","蒽","蓓","蓊","蒿"2336 ,"蒺","蓠","蒡","蒹","蒴","蒗","蓥","蓣","蔌","甍","蔸","蓰","蔹","蔟","蔺"2337 ,"蕖","蔻","蓿","蓼","蕙","蕈","蕨","蕤","蕞","蕺","瞢","蕃","蕲","蕻","薤"2338 ,"薨","薇","薏","蕹","薮","薜","薅","薹","薷","薰","藓","藁","藜","藿","蘧","蘅"2339 ,"蘩","蘖","蘼","廾","弈","夼","奁","耷","奕","奚","奘","匏","尢","尥","尬","尴"2340 ,"扌","扪","抟","抻","拊","拚","拗","拮","挢","拶","挹","捋","捃","掭","揶","捱"2341 ,"捺","掎","掴","捭","掬","掊","捩","掮","掼","揲","揸","揠","揿","揄","揞","揎"2342 ,"摒","揆","掾","摅","摁","搋","搛","搠","搌","搦","搡","摞","撄","摭","撖"2343 ,"摺","撷","撸","撙","撺","擀","擐","擗","擤","擢","攉","攥","攮","弋","忒"2344 ,"甙","弑","卟","叱","叽","叩","叨","叻","吒","吖","吆","呋","呒","呓","呔","呖"2345 ,"呃","吡","呗","呙","吣","吲","咂","咔","呷","呱","呤","咚","咛","咄","呶","呦"2346 ,"咝","哐","咭","哂","咴","哒","咧","咦","哓","哔","呲","咣","哕","咻","咿","哌"2347 ,"哙","哚","哜","咩","咪","咤","哝","哏","哞","唛","哧","唠","哽","唔","哳","唢"2348 ,"唣","唏","唑","唧","唪","啧","喏","喵","啉","啭","啁","啕","唿","啐","唼"2349 ,"唷","啖","啵","啶","啷","唳","唰","啜","喋","嗒","喃","喱","喹","喈","喁"2350 ,"喟","啾","嗖","喑","啻","嗟","喽","喾","喔","喙","嗪","嗷","嗉","嘟","嗑","嗫"2351 ,"嗬","嗔","嗦","嗝","嗄","嗯","嗥","嗲","嗳","嗌","嗍","嗨","嗵","嗤","辔","嘞"2352 ,"嘈","嘌","嘁","嘤","嘣","嗾","嘀","嘧","嘭","噘","嘹","噗","嘬","噍","噢","噙"2353 ,"噜","噌","噔","嚆","噤","噱","噫","噻","噼","嚅","嚓","嚯","囔","囗","囝","囡"2354 ,"囵","囫","囹","囿","圄","圊","圉","圜","帏","帙","帔","帑","帱","帻","帼"2355 ,"帷","幄","幔","幛","幞","幡","岌","屺","岍","岐","岖","岈","岘","岙","岑"2356 ,"岚","岜","岵","岢","岽","岬","岫","岱","岣","峁","岷","峄","峒","峤","峋","峥"2357 ,"崂","崃","崧","崦","崮","崤","崞","崆","崛","嵘","崾","崴","崽","嵬","嵛","嵯"2358 ,"嵝","嵫","嵋","嵊","嵩","嵴","嶂","嶙","嶝","豳","嶷","巅","彳","彷","徂","徇"2359 ,"徉","後","徕","徙","徜","徨","徭","徵","徼","衢","彡","犭","犰","犴","犷","犸"2360 ,"狃","狁","狎","狍","狒","狨","狯","狩","狲","狴","狷","猁","狳","猃","狺"2361 ,"狻","猗","猓","猡","猊","猞","猝","猕","猢","猹","猥","猬","猸","猱","獐"2362 ,"獍","獗","獠","獬","獯","獾","舛","夥","飧","夤","夂","饣","饧","饨","饩","饪"2363 ,"饫","饬","饴","饷","饽","馀","馄","馇","馊","馍","馐","馑","馓","馔","馕","庀"2364 ,"庑","庋","庖","庥","庠","庹","庵","庾","庳","赓","廒","廑","廛","廨","廪","膺"2365 ,"忄","忉","忖","忏","怃","忮","怄","忡","忤","忾","怅","怆","忪","忭","忸","怙"2366 ,"怵","怦","怛","怏","怍","怩","怫","怊","怿","怡","恸","恹","恻","恺","恂"2367 ,"恪","恽","悖","悚","悭","悝","悃","悒","悌","悛","惬","悻","悱","惝","惘"2368 ,"惆","惚","悴","愠","愦","愕","愣","惴","愀","愎","愫","慊","慵","憬","憔","憧"2369 ,"憷","懔","懵","忝","隳","闩","闫","闱","闳","闵","闶","闼","闾","阃","阄","阆"2370 ,"阈","阊","阋","阌","阍","阏","阒","阕","阖","阗","阙","阚","丬","爿","戕","氵"2371 ,"汔","汜","汊","沣","沅","沐","沔","沌","汨","汩","汴","汶","沆","沩","泐","泔"2372 ,"沭","泷","泸","泱","泗","沲","泠","泖","泺","泫","泮","沱","泓","泯","泾"2373 ,"洹","洧","洌","浃","浈","洇","洄","洙","洎","洫","浍","洮","洵","洚","浏"2374 ,"浒","浔","洳","涑","浯","涞","涠","浞","涓","涔","浜","浠","浼","浣","渚","淇"2375 ,"淅","淞","渎","涿","淠","渑","淦","淝","淙","渖","涫","渌","涮","渫","湮","湎"2376 ,"湫","溲","湟","溆","湓","湔","渲","渥","湄","滟","溱","溘","滠","漭","滢","溥"2377 ,"溧","溽","溻","溷","滗","溴","滏","溏","滂","溟","潢","潆","潇","漤","漕","滹"2378 ,"漯","漶","潋","潴","漪","漉","漩","澉","澍","澌","潸","潲","潼","潺","濑"2379 ,"濉","澧","澹","澶","濂","濡","濮","濞","濠","濯","瀚","瀣","瀛","瀹","瀵"2380 ,"灏","灞","宀","宄","宕","宓","宥","宸","甯","骞","搴","寤","寮","褰","寰","蹇"2381 ,"謇","辶","迓","迕","迥","迮","迤","迩","迦","迳","迨","逅","逄","逋","逦","逑"2382 ,"逍","逖","逡","逵","逶","逭","逯","遄","遑","遒","遐","遨","遘","遢","遛","暹"2383 ,"遴","遽","邂","邈","邃","邋","彐","彗","彖","彘","尻","咫","屐","屙","孱","屣"2384 ,"屦","羼","弪","弩","弭","艴","弼","鬻","屮","妁","妃","妍","妩","妪","妣"2385 ,"妗","姊","妫","妞","妤","姒","妲","妯","姗","妾","娅","娆","姝","娈","姣"2386 ,"姘","姹","娌","娉","娲","娴","娑","娣","娓","婀","婧","婊","婕","娼","婢","婵"2387 ,"胬","媪","媛","婷","婺","媾","嫫","媲","嫒","嫔","媸","嫠","嫣","嫱","嫖","嫦"2388 ,"嫘","嫜","嬉","嬗","嬖","嬲","嬷","孀","尕","尜","孚","孥","孳","孑","孓","孢"2389 ,"驵","驷","驸","驺","驿","驽","骀","骁","骅","骈","骊","骐","骒","骓","骖","骘"2390 ,"骛","骜","骝","骟","骠","骢","骣","骥","骧","纟","纡","纣","纥","纨","纩"2391 ,"纭","纰","纾","绀","绁","绂","绉","绋","绌","绐","绔","绗","绛","绠","绡"2392 ,"绨","绫","绮","绯","绱","绲","缍","绶","绺","绻","绾","缁","缂","缃","缇","缈"2393 ,"缋","缌","缏","缑","缒","缗","缙","缜","缛","缟","缡","缢","缣","缤","缥","缦"2394 ,"缧","缪","缫","缬","缭","缯","缰","缱","缲","缳","缵","幺","畿","巛","甾","邕"2395 ,"玎","玑","玮","玢","玟","珏","珂","珑","玷","玳","珀","珉","珈","珥","珙","顼"2396 ,"琊","珩","珧","珞","玺","珲","琏","琪","瑛","琦","琥","琨","琰","琮","琬"2397 ,"琛","琚","瑁","瑜","瑗","瑕","瑙","瑷","瑭","瑾","璜","璎","璀","璁","璇"2398 ,"璋","璞","璨","璩","璐","璧","瓒","璺","韪","韫","韬","杌","杓","杞","杈","杩"2399 ,"枥","枇","杪","杳","枘","枧","杵","枨","枞","枭","枋","杷","杼","柰","栉","柘"2400 ,"栊","柩","枰","栌","柙","枵","柚","枳","柝","栀","柃","枸","柢","栎","柁","柽"2401 ,"栲","栳","桠","桡","桎","桢","桄","桤","梃","栝","桕","桦","桁","桧","桀","栾"2402 ,"桊","桉","栩","梵","梏","桴","桷","梓","桫","棂","楮","棼","椟","椠","棹"2403 ,"椤","棰","椋","椁","楗","棣","椐","楱","椹","楠","楂","楝","榄","楫","榀"2404 ,"榘","楸","椴","槌","榇","榈","槎","榉","楦","楣","楹","榛","榧","榻","榫","榭"2405 ,"槔","榱","槁","槊","槟","榕","槠","榍","槿","樯","槭","樗","樘","橥","槲","橄"2406 ,"樾","檠","橐","橛","樵","檎","橹","樽","樨","橘","橼","檑","檐","檩","檗","檫"2407 ,"猷","獒","殁","殂","殇","殄","殒","殓","殍","殚","殛","殡","殪","轫","轭","轱"2408 ,"轲","轳","轵","轶","轸","轷","轹","轺","轼","轾","辁","辂","辄","辇","辋"2409 ,"辍","辎","辏","辘","辚","軎","戋","戗","戛","戟","戢","戡","戥","戤","戬"2410 ,"臧","瓯","瓴","瓿","甏","甑","甓","攴","旮","旯","旰","昊","昙","杲","昃","昕"2411 ,"昀","炅","曷","昝","昴","昱","昶","昵","耆","晟","晔","晁","晏","晖","晡","晗"2412 ,"晷","暄","暌","暧","暝","暾","曛","曜","曦","曩","贲","贳","贶","贻","贽","赀"2413 ,"赅","赆","赈","赉","赇","赍","赕","赙","觇","觊","觋","觌","觎","觏","觐","觑"2414 ,"牮","犟","牝","牦","牯","牾","牿","犄","犋","犍","犏","犒","挈","挲","掰"2415 ,"搿","擘","耄","毪","毳","毽","毵","毹","氅","氇","氆","氍","氕","氘","氙"2416 ,"氚","氡","氩","氤","氪","氲","攵","敕","敫","牍","牒","牖","爰","虢","刖","肟"2417 ,"肜","肓","肼","朊","肽","肱","肫","肭","肴","肷","胧","胨","胩","胪","胛","胂"2418 ,"胄","胙","胍","胗","朐","胝","胫","胱","胴","胭","脍","脎","胲","胼","朕","脒"2419 ,"豚","脶","脞","脬","脘","脲","腈","腌","腓","腴","腙","腚","腱","腠","腩","腼"2420 ,"腽","腭","腧","塍","媵","膈","膂","膑","滕","膣","膪","臌","朦","臊","膻"2421 ,"臁","膦","欤","欷","欹","歃","歆","歙","飑","飒","飓","飕","飙","飚","殳"2422 ,"彀","毂","觳","斐","齑","斓","於","旆","旄","旃","旌","旎","旒","旖","炀","炜"2423 ,"炖","炝","炻","烀","炷","炫","炱","烨","烊","焐","焓","焖","焯","焱","煳","煜"2424 ,"煨","煅","煲","煊","煸","煺","熘","熳","熵","熨","熠","燠","燔","燧","燹","爝"2425 ,"爨","灬","焘","煦","熹","戾","戽","扃","扈","扉","礻","祀","祆","祉","祛","祜"2426 ,"祓","祚","祢","祗","祠","祯","祧","祺","禅","禊","禚","禧","禳","忑","忐"2427 ,"怼","恝","恚","恧","恁","恙","恣","悫","愆","愍","慝","憩","憝","懋","懑"2428 ,"戆","肀","聿","沓","泶","淼","矶","矸","砀","砉","砗","砘","砑","斫","砭","砜"2429 ,"砝","砹","砺","砻","砟","砼","砥","砬","砣","砩","硎","硭","硖","硗","砦","硐"2430 ,"硇","硌","硪","碛","碓","碚","碇","碜","碡","碣","碲","碹","碥","磔","磙","磉"2431 ,"磬","磲","礅","磴","礓","礤","礞","礴","龛","黹","黻","黼","盱","眄","眍","盹"2432 ,"眇","眈","眚","眢","眙","眭","眦","眵","眸","睐","睑","睇","睃","睚","睨"2433 ,"睢","睥","睿","瞍","睽","瞀","瞌","瞑","瞟","瞠","瞰","瞵","瞽","町","畀"2434 ,"畎","畋","畈","畛","畲","畹","疃","罘","罡","罟","詈","罨","罴","罱","罹","羁"2435 ,"罾","盍","盥","蠲","钅","钆","钇","钋","钊","钌","钍","钏","钐","钔","钗","钕"2436 ,"钚","钛","钜","钣","钤","钫","钪","钭","钬","钯","钰","钲","钴","钶","钷","钸"2437 ,"钹","钺","钼","钽","钿","铄","铈","铉","铊","铋","铌","铍","铎","铐","铑","铒"2438 ,"铕","铖","铗","铙","铘","铛","铞","铟","铠","铢","铤","铥","铧","铨","铪"2439 ,"铩","铫","铮","铯","铳","铴","铵","铷","铹","铼","铽","铿","锃","锂","锆"2440 ,"锇","锉","锊","锍","锎","锏","锒","锓","锔","锕","锖","锘","锛","锝","锞","锟"2441 ,"锢","锪","锫","锩","锬","锱","锲","锴","锶","锷","锸","锼","锾","锿","镂","锵"2442 ,"镄","镅","镆","镉","镌","镎","镏","镒","镓","镔","镖","镗","镘","镙","镛","镞"2443 ,"镟","镝","镡","镢","镤","镥","镦","镧","镨","镩","镪","镫","镬","镯","镱","镲"2444 ,"镳","锺","矧","矬","雉","秕","秭","秣","秫","稆","嵇","稃","稂","稞","稔"2445 ,"稹","稷","穑","黏","馥","穰","皈","皎","皓","皙","皤","瓞","瓠","甬","鸠"2446 ,"鸢","鸨","鸩","鸪","鸫","鸬","鸲","鸱","鸶","鸸","鸷","鸹","鸺","鸾","鹁","鹂"2447 ,"鹄","鹆","鹇","鹈","鹉","鹋","鹌","鹎","鹑","鹕","鹗","鹚","鹛","鹜","鹞","鹣"2448 ,"鹦","鹧","鹨","鹩","鹪","鹫","鹬","鹱","鹭","鹳","疒","疔","疖","疠","疝","疬"2449 ,"疣","疳","疴","疸","痄","疱","疰","痃","痂","痖","痍","痣","痨","痦","痤","痫"2450 ,"痧","瘃","痱","痼","痿","瘐","瘀","瘅","瘌","瘗","瘊","瘥","瘘","瘕","瘙"2451 ,"瘛","瘼","瘢","瘠","癀","瘭","瘰","瘿","瘵","癃","瘾","瘳","癍","癞","癔"2452 ,"癜","癖","癫","癯","翊","竦","穸","穹","窀","窆","窈","窕","窦","窠","窬","窨"2453 ,"窭","窳","衤","衩","衲","衽","衿","袂","袢","裆","袷","袼","裉","裢","裎","裣"2454 ,"裥","裱","褚","裼","裨","裾","裰","褡","褙","褓","褛","褊","褴","褫","褶","襁"2455 ,"襦","襻","疋","胥","皲","皴","矜","耒","耔","耖","耜","耠","耢","耥","耦","耧"2456 ,"耩","耨","耱","耋","耵","聃","聆","聍","聒","聩","聱","覃","顸","颀","颃"2457 ,"颉","颌","颍","颏","颔","颚","颛","颞","颟","颡","颢","颥","颦","虍","虔"2458 ,"虬","虮","虿","虺","虼","虻","蚨","蚍","蚋","蚬","蚝","蚧","蚣","蚪","蚓","蚩"2459 ,"蚶","蛄","蚵","蛎","蚰","蚺","蚱","蚯","蛉","蛏","蚴","蛩","蛱","蛲","蛭","蛳"2460 ,"蛐","蜓","蛞","蛴","蛟","蛘","蛑","蜃","蜇","蛸","蜈","蜊","蜍","蜉","蜣","蜻"2461 ,"蜞","蜥","蜮","蜚","蜾","蝈","蜴","蜱","蜩","蜷","蜿","螂","蜢","蝽","蝾","蝻"2462 ,"蝠","蝰","蝌","蝮","螋","蝓","蝣","蝼","蝤","蝙","蝥","螓","螯","螨","蟒"2463 ,"蟆","螈","螅","螭","螗","螃","螫","蟥","螬","螵","螳","蟋","蟓","螽","蟑"2464 ,"蟀","蟊","蟛","蟪","蟠","蟮","蠖","蠓","蟾","蠊","蠛","蠡","蠹","蠼","缶","罂"2465 ,"罄","罅","舐","竺","竽","笈","笃","笄","笕","笊","笫","笏","筇","笸","笪","笙"2466 ,"笮","笱","笠","笥","笤","笳","笾","笞","筘","筚","筅","筵","筌","筝","筠","筮"2467 ,"筻","筢","筲","筱","箐","箦","箧","箸","箬","箝","箨","箅","箪","箜","箢","箫"2468 ,"箴","篑","篁","篌","篝","篚","篥","篦","篪","簌","篾","篼","簏","簖","簋"2469 ,"簟","簪","簦","簸","籁","籀","臾","舁","舂","舄","臬","衄","舡","舢","舣"2470 ,"舭","舯","舨","舫","舸","舻","舳","舴","舾","艄","艉","艋","艏","艚","艟","艨"2471 ,"衾","袅","袈","裘","裟","襞","羝","羟","羧","羯","羰","羲","籼","敉","粑","粝"2472 ,"粜","粞","粢","粲","粼","粽","糁","糇","糌","糍","糈","糅","糗","糨","艮","暨"2473 ,"羿","翎","翕","翥","翡","翦","翩","翮","翳","糸","絷","綦","綮","繇","纛","麸"2474 ,"麴","赳","趄","趔","趑","趱","赧","赭","豇","豉","酊","酐","酎","酏","酤"2475 ,"酢","酡","酰","酩","酯","酽","酾","酲","酴","酹","醌","醅","醐","醍","醑"2476 ,"醢","醣","醪","醭","醮","醯","醵","醴","醺","豕","鹾","趸","跫","踅","蹙","蹩"2477 ,"趵","趿","趼","趺","跄","跖","跗","跚","跞","跎","跏","跛","跆","跬","跷","跸"2478 ,"跣","跹","跻","跤","踉","跽","踔","踝","踟","踬","踮","踣","踯","踺","蹀","踹"2479 ,"踵","踽","踱","蹉","蹁","蹂","蹑","蹒","蹊","蹰","蹶","蹼","蹯","蹴","躅","躏"2480 ,"躔","躐","躜","躞","豸","貂","貊","貅","貘","貔","斛","觖","觞","觚","觜"2481 ,"觥","觫","觯","訾","謦","靓","雩","雳","雯","霆","霁","霈","霏","霎","霪"2482 ,"霭","霰","霾","龀","龃","龅","龆","龇","龈","龉","龊","龌","黾","鼋","鼍","隹"2483 ,"隼","隽","雎","雒","瞿","雠","銎","銮","鋈","錾","鍪","鏊","鎏","鐾","鑫","鱿"2484 ,"鲂","鲅","鲆","鲇","鲈","稣","鲋","鲎","鲐","鲑","鲒","鲔","鲕","鲚","鲛","鲞"2485 ,"鲟","鲠","鲡","鲢","鲣","鲥","鲦","鲧","鲨","鲩","鲫","鲭","鲮","鲰","鲱","鲲"2486 ,"鲳","鲴","鲵","鲶","鲷","鲺","鲻","鲼","鲽","鳄","鳅","鳆","鳇","鳊","鳋"2487 ,"鳌","鳍","鳎","鳏","鳐","鳓","鳔","鳕","鳗","鳘","鳙","鳜","鳝","鳟","鳢"2488 ,"靼","鞅","鞑","鞒","鞔","鞯","鞫","鞣","鞲","鞴","骱","骰","骷","鹘","骶","骺"2489 ,"骼","髁","髀","髅","髂","髋","髌","髑","魅","魃","魇","魉","魈","魍","魑","飨"2490 ,"餍","餮","饕","饔","髟","髡","髦","髯","髫","髻","髭","髹","鬈","鬏","鬓","鬟"2491 ,"鬣","麽","麾","縻","麂","麇","麈","麋","麒","鏖","麝","麟","黛","黜","黝","黠"2492 ,"黟","黢","黩","黧","黥","黪","黯","鼢","鼬","鼯","鼹","鼷","鼽","鼾","齄"2493 };2494 2495 /// <summary>2496 /// 二级汉字对应拼音数组2497 /// </summary>2498 private static string[] otherPinYin = new string[]2499 { 2500 "Chu","Ji","Wu","Gai","Nian","Sa","Pi","Gen","Cheng","Ge","Nao","E","Shu","Yu","Pie","Bi",2501 "Tuo","Yao","Yao","Zhi","Di","Xin","Yin","Kui","Yu","Gao","Tao","Dian","Ji","Nai","Nie","Ji",2502 "Qi","Mi","Bei","Se","Gu","Ze","She","Cuo","Yan","Jue","Si","Ye","Yan","Fang","Po","Gui",2503 "Kui","Bian","Ze","Gua","You","Ce","Yi","Wen","Jing","Ku","Gui","Kai","La","Ji","Yan","Wan",2504 "Kuai","Piao","Jue","Qiao","Huo","Yi","Tong","Wang","Dan","Ding","Zhang","Le","Sa","Yi","Mu","Ren",2505 "Yu","Pi","Ya","Wa","Wu","Chang","Cang","Kang","Zhu","Ning","Ka","You","Yi","Gou","Tong","Tuo",2506 "Ni","Ga","Ji","Er","You","Kua","Kan","Zhu","Yi","Tiao","Chai","Jiao","Nong","Mou","Chou","Yan",2507 "Li","Qiu","Li","Yu","Ping","Yong","Si","Feng","Qian","Ruo","Pai","Zhuo","Shu","Luo","Wo","Bi",2508 "Ti","Guan","Kong","Ju","Fen","Yan","Xie","Ji","Wei","Zong","Lou","Tang","Bin","Nuo","Chi","Xi",2509 "Jing","Jian","Jiao","Jiu","Tong","Xuan","Dan","Tong","Tun","She","Qian","Zu","Yue","Cuan","Di","Xi",2510 "Xun","Hong","Guo","Chan","Kui","Bao","Pu","Hong","Fu","Fu","Su","Si","Wen","Yan","Bo","Gun",2511 "Mao","Xie","Luan","Pou","Bing","Ying","Luo","Lei","Liang","Hu","Lie","Xian","Song","Ping","Zhong","Ming",2512 "Yan","Jie","Hong","Shan","Ou","Ju","Ne","Gu","He","Di","Zhao","Qu","Dai","Kuang","Lei","Gua",2513 "Jie","Hui","Shen","Gou","Quan","Zheng","Hun","Xu","Qiao","Gao","Kuang","Ei","Zou","Zhuo","Wei","Yu",2514 "Shen","Chan","Sui","Chen","Jian","Xue","Ye","E","Yu","Xuan","An","Di","Zi","Pian","Mo","Dang",2515 "Su","Shi","Mi","Zhe","Jian","Zen","Qiao","Jue","Yan","Zhan","Chen","Dan","Jin","Zuo","Wu","Qian",2516 "Jing","Ban","Yan","Zuo","Bei","Jing","Gai","Zhi","Nie","Zou","Chui","Pi","Wei","Huang","Wei","Xi",2517 "Han","Qiong","Kuang","Mang","Wu","Fang","Bing","Pi","Bei","Ye","Di","Tai","Jia","Zhi","Zhu","Kuai",2518 "Qie","Xun","Yun","Li","Ying","Gao","Xi","Fu","Pi","Tan","Yan","Juan","Yan","Yin","Zhang","Po",2519 "Shan","Zou","Ling","Feng","Chu","Huan","Mai","Qu","Shao","He","Ge","Meng","Xu","Xie","Sou","Xie",2520 "Jue","Jian","Qian","Dang","Chang","Si","Bian","Ben","Qiu","Ben","E","Fa","Shu","Ji","Yong","He",2521 "Wei","Wu","Ge","Zhen","Kuang","Pi","Yi","Li","Qi","Ban","Gan","Long","Dian","Lu","Che","Di",2522 "Tuo","Ni","Mu","Ao","Ya","Die","Dong","Kai","Shan","Shang","Nao","Gai","Yin","Cheng","Shi","Guo",2523 "Xun","Lie","Yuan","Zhi","An","Yi","Pi","Nian","Peng","Tu","Sao","Dai","Ku","Die","Yin","Leng",2524 "Hou","Ge","Yuan","Man","Yong","Liang","Chi","Xin","Pi","Yi","Cao","Jiao","Nai","Du","Qian","Ji",2525 "Wan","Xiong","Qi","Xiang","Fu","Yuan","Yun","Fei","Ji","Li","E","Ju","Pi","Zhi","Rui","Xian",2526 "Chang","Cong","Qin","Wu","Qian","Qi","Shan","Bian","Zhu","Kou","Yi","Mo","Gan","Pie","Long","Ba",2527 "Mu","Ju","Ran","Qing","Chi","Fu","Ling","Niao","Yin","Mao","Ying","Qiong","Min","Tiao","Qian","Yi",2528 "Rao","Bi","Zi","Ju","Tong","Hui","Zhu","Ting","Qiao","Fu","Ren","Xing","Quan","Hui","Xun","Ming",2529 "Qi","Jiao","Chong","Jiang","Luo","Ying","Qian","Gen","Jin","Mai","Sun","Hong","Zhou","Kan","Bi","Shi",2530 "Wo","You","E","Mei","You","Li","Tu","Xian","Fu","Sui","You","Di","Shen","Guan","Lang","Ying",2531 "Chun","Jing","Qi","Xi","Song","Jin","Nai","Qi","Ba","Shu","Chang","Tie","Yu","Huan","Bi","Fu",2532 "Tu","Dan","Cui","Yan","Zu","Dang","Jian","Wan","Ying","Gu","Han","Qia","Feng","Shen","Xiang","Wei",2533 "Chan","Kai","Qi","Kui","Xi","E","Bao","Pa","Ting","Lou","Pai","Xuan","Jia","Zhen","Shi","Ru",2534 "Mo","En","Bei","Weng","Hao","Ji","Li","Bang","Jian","Shuo","Lang","Ying","Yu","Su","Meng","Dou",2535 "Xi","Lian","Cu","Lin","Qu","Kou","Xu","Liao","Hui","Xun","Jue","Rui","Zui","Ji","Meng","Fan",2536 "Qi","Hong","Xie","Hong","Wei","Yi","Weng","Sou","Bi","Hao","Tai","Ru","Xun","Xian","Gao","Li",2537 "Huo","Qu","Heng","Fan","Nie","Mi","Gong","Yi","Kuang","Lian","Da","Yi","Xi","Zang","Pao","You",2538 "Liao","Ga","Gan","Ti","Men","Tuan","Chen","Fu","Pin","Niu","Jie","Jiao","Za","Yi","Lv","Jun",2539 "Tian","Ye","Ai","Na","Ji","Guo","Bai","Ju","Pou","Lie","Qian","Guan","Die","Zha","Ya","Qin",2540 "Yu","An","Xuan","Bing","Kui","Yuan","Shu","En","Chuai","Jian","Shuo","Zhan","Nuo","Sang","Luo","Ying",2541 "Zhi","Han","Zhe","Xie","Lu","Zun","Cuan","Gan","Huan","Pi","Xing","Zhuo","Huo","Zuan","Nang","Yi",2542 "Te","Dai","Shi","Bu","Chi","Ji","Kou","Dao","Le","Zha","A","Yao","Fu","Mu","Yi","Tai",2543 "Li","E","Bi","Bei","Guo","Qin","Yin","Za","Ka","Ga","Gua","Ling","Dong","Ning","Duo","Nao",2544 "You","Si","Kuang","Ji","Shen","Hui","Da","Lie","Yi","Xiao","Bi","Ci","Guang","Yue","Xiu","Yi",2545 "Pai","Kuai","Duo","Ji","Mie","Mi","Zha","Nong","Gen","Mou","Mai","Chi","Lao","Geng","En","Zha",2546 "Suo","Zao","Xi","Zuo","Ji","Feng","Ze","Nuo","Miao","Lin","Zhuan","Zhou","Tao","Hu","Cui","Sha",2547 "Yo","Dan","Bo","Ding","Lang","Li","Shua","Chuo","Die","Da","Nan","Li","Kui","Jie","Yong","Kui",2548 "Jiu","Sou","Yin","Chi","Jie","Lou","Ku","Wo","Hui","Qin","Ao","Su","Du","Ke","Nie","He",2549 "Chen","Suo","Ge","A","En","Hao","Dia","Ai","Ai","Suo","Hei","Tong","Chi","Pei","Lei","Cao",2550 "Piao","Qi","Ying","Beng","Sou","Di","Mi","Peng","Jue","Liao","Pu","Chuai","Jiao","O","Qin","Lu",2551 "Ceng","Deng","Hao","Jin","Jue","Yi","Sai","Pi","Ru","Cha","Huo","Nang","Wei","Jian","Nan","Lun",2552 "Hu","Ling","You","Yu","Qing","Yu","Huan","Wei","Zhi","Pei","Tang","Dao","Ze","Guo","Wei","Wo",2553 "Man","Zhang","Fu","Fan","Ji","Qi","Qian","Qi","Qu","Ya","Xian","Ao","Cen","Lan","Ba","Hu",2554 "Ke","Dong","Jia","Xiu","Dai","Gou","Mao","Min","Yi","Dong","Qiao","Xun","Zheng","Lao","Lai","Song",2555 "Yan","Gu","Xiao","Guo","Kong","Jue","Rong","Yao","Wai","Zai","Wei","Yu","Cuo","Lou","Zi","Mei",2556 "Sheng","Song","Ji","Zhang","Lin","Deng","Bin","Yi","Dian","Chi","Pang","Cu","Xun","Yang","Hou","Lai",2557 "Xi","Chang","Huang","Yao","Zheng","Jiao","Qu","San","Fan","Qiu","An","Guang","Ma","Niu","Yun","Xia",2558 "Pao","Fei","Rong","Kuai","Shou","Sun","Bi","Juan","Li","Yu","Xian","Yin","Suan","Yi","Guo","Luo",2559 "Ni","She","Cu","Mi","Hu","Cha","Wei","Wei","Mei","Nao","Zhang","Jing","Jue","Liao","Xie","Xun",2560 "Huan","Chuan","Huo","Sun","Yin","Dong","Shi","Tang","Tun","Xi","Ren","Yu","Chi","Yi","Xiang","Bo",2561 "Yu","Hun","Zha","Sou","Mo","Xiu","Jin","San","Zhuan","Nang","Pi","Wu","Gui","Pao","Xiu","Xiang",2562 "Tuo","An","Yu","Bi","Geng","Ao","Jin","Chan","Xie","Lin","Ying","Shu","Dao","Cun","Chan","Wu",2563 "Zhi","Ou","Chong","Wu","Kai","Chang","Chuang","Song","Bian","Niu","Hu","Chu","Peng","Da","Yang","Zuo",2564 "Ni","Fu","Chao","Yi","Yi","Tong","Yan","Ce","Kai","Xun","Ke","Yun","Bei","Song","Qian","Kui",2565 "Kun","Yi","Ti","Quan","Qie","Xing","Fei","Chang","Wang","Chou","Hu","Cui","Yun","Kui","E","Leng",2566 "Zhui","Qiao","Bi","Su","Qie","Yong","Jing","Qiao","Chong","Chu","Lin","Meng","Tian","Hui","Shuan","Yan",2567 "Wei","Hong","Min","Kang","Ta","Lv","Kun","Jiu","Lang","Yu","Chang","Xi","Wen","Hun","E","Qu",2568 "Que","He","Tian","Que","Kan","Jiang","Pan","Qiang","San","Qi","Si","Cha","Feng","Yuan","Mu","Mian",2569 "Dun","Mi","Gu","Bian","Wen","Hang","Wei","Le","Gan","Shu","Long","Lu","Yang","Si","Duo","Ling",2570 "Mao","Luo","Xuan","Pan","Duo","Hong","Min","Jing","Huan","Wei","Lie","Jia","Zhen","Yin","Hui","Zhu",2571 "Ji","Xu","Hui","Tao","Xun","Jiang","Liu","Hu","Xun","Ru","Su","Wu","Lai","Wei","Zhuo","Juan",2572 "Cen","Bang","Xi","Mei","Huan","Zhu","Qi","Xi","Song","Du","Zhuo","Pei","Mian","Gan","Fei","Cong",2573 "Shen","Guan","Lu","Shuan","Xie","Yan","Mian","Qiu","Sou","Huang","Xu","Pen","Jian","Xuan","Wo","Mei",2574 "Yan","Qin","Ke","She","Mang","Ying","Pu","Li","Ru","Ta","Hun","Bi","Xiu","Fu","Tang","Pang",2575 "Ming","Huang","Ying","Xiao","Lan","Cao","Hu","Luo","Huan","Lian","Zhu","Yi","Lu","Xuan","Gan","Shu",2576 "Si","Shan","Shao","Tong","Chan","Lai","Sui","Li","Dan","Chan","Lian","Ru","Pu","Bi","Hao","Zhuo",2577 "Han","Xie","Ying","Yue","Fen","Hao","Ba","Bao","Gui","Dang","Mi","You","Chen","Ning","Jian","Qian",2578 "Wu","Liao","Qian","Huan","Jian","Jian","Zou","Ya","Wu","Jiong","Ze","Yi","Er","Jia","Jing","Dai",2579 "Hou","Pang","Bu","Li","Qiu","Xiao","Ti","Qun","Kui","Wei","Huan","Lu","Chuan","Huang","Qiu","Xia",2580 "Ao","Gou","Ta","Liu","Xian","Lin","Ju","Xie","Miao","Sui","La","Ji","Hui","Tuan","Zhi","Kao",2581 "Zhi","Ji","E","Chan","Xi","Ju","Chan","Jing","Nu","Mi","Fu","Bi","Yu","Che","Shuo","Fei",2582 "Yan","Wu","Yu","Bi","Jin","Zi","Gui","Niu","Yu","Si","Da","Zhou","Shan","Qie","Ya","Rao",2583 "Shu","Luan","Jiao","Pin","Cha","Li","Ping","Wa","Xian","Suo","Di","Wei","E","Jing","Biao","Jie",2584 "Chang","Bi","Chan","Nu","Ao","Yuan","Ting","Wu","Gou","Mo","Pi","Ai","Pin","Chi","Li","Yan",2585 "Qiang","Piao","Chang","Lei","Zhang","Xi","Shan","Bi","Niao","Mo","Shuang","Ga","Ga","Fu","Nu","Zi",2586 "Jie","Jue","Bao","Zang","Si","Fu","Zou","Yi","Nu","Dai","Xiao","Hua","Pian","Li","Qi","Ke",2587 "Zhui","Can","Zhi","Wu","Ao","Liu","Shan","Biao","Cong","Chan","Ji","Xiang","Jiao","Yu","Zhou","Ge",2588 "Wan","Kuang","Yun","Pi","Shu","Gan","Xie","Fu","Zhou","Fu","Chu","Dai","Ku","Hang","Jiang","Geng",2589 "Xiao","Ti","Ling","Qi","Fei","Shang","Gun","Duo","Shou","Liu","Quan","Wan","Zi","Ke","Xiang","Ti",2590 "Miao","Hui","Si","Bian","Gou","Zhui","Min","Jin","Zhen","Ru","Gao","Li","Yi","Jian","Bin","Piao",2591 "Man","Lei","Miao","Sao","Xie","Liao","Zeng","Jiang","Qian","Qiao","Huan","Zuan","Yao","Ji","Chuan","Zai",2592 "Yong","Ding","Ji","Wei","Bin","Min","Jue","Ke","Long","Dian","Dai","Po","Min","Jia","Er","Gong",2593 "Xu","Ya","Heng","Yao","Luo","Xi","Hui","Lian","Qi","Ying","Qi","Hu","Kun","Yan","Cong","Wan",2594 "Chen","Ju","Mao","Yu","Yuan","Xia","Nao","Ai","Tang","Jin","Huang","Ying","Cui","Cong","Xuan","Zhang",2595 "Pu","Can","Qu","Lu","Bi","Zan","Wen","Wei","Yun","Tao","Wu","Shao","Qi","Cha","Ma","Li",2596 "Pi","Miao","Yao","Rui","Jian","Chu","Cheng","Cong","Xiao","Fang","Pa","Zhu","Nai","Zhi","Zhe","Long",2597 "Jiu","Ping","Lu","Xia","Xiao","You","Zhi","Tuo","Zhi","Ling","Gou","Di","Li","Tuo","Cheng","Kao",2598 "Lao","Ya","Rao","Zhi","Zhen","Guang","Qi","Ting","Gua","Jiu","Hua","Heng","Gui","Jie","Luan","Juan",2599 "An","Xu","Fan","Gu","Fu","Jue","Zi","Suo","Ling","Chu","Fen","Du","Qian","Zhao","Luo","Chui",2600 "Liang","Guo","Jian","Di","Ju","Cou","Zhen","Nan","Zha","Lian","Lan","Ji","Pin","Ju","Qiu","Duan",2601 "Chui","Chen","Lv","Cha","Ju","Xuan","Mei","Ying","Zhen","Fei","Ta","Sun","Xie","Gao","Cui","Gao",2602 "Shuo","Bin","Rong","Zhu","Xie","Jin","Qiang","Qi","Chu","Tang","Zhu","Hu","Gan","Yue","Qing","Tuo",2603 "Jue","Qiao","Qin","Lu","Zun","Xi","Ju","Yuan","Lei","Yan","Lin","Bo","Cha","You","Ao","Mo",2604 "Cu","Shang","Tian","Yun","Lian","Piao","Dan","Ji","Bin","Yi","Ren","E","Gu","Ke","Lu","Zhi",2605 "Yi","Zhen","Hu","Li","Yao","Shi","Zhi","Quan","Lu","Zhe","Nian","Wang","Chuo","Zi","Cou","Lu",2606 "Lin","Wei","Jian","Qiang","Jia","Ji","Ji","Kan","Deng","Gai","Jian","Zang","Ou","Ling","Bu","Beng",2607 "Zeng","Pi","Po","Ga","La","Gan","Hao","Tan","Gao","Ze","Xin","Yun","Gui","He","Zan","Mao",2608 "Yu","Chang","Ni","Qi","Sheng","Ye","Chao","Yan","Hui","Bu","Han","Gui","Xuan","Kui","Ai","Ming",2609 "Tun","Xun","Yao","Xi","Nang","Ben","Shi","Kuang","Yi","Zhi","Zi","Gai","Jin","Zhen","Lai","Qiu",2610 "Ji","Dan","Fu","Chan","Ji","Xi","Di","Yu","Gou","Jin","Qu","Jian","Jiang","Pin","Mao","Gu",2611 "Wu","Gu","Ji","Ju","Jian","Pian","Kao","Qie","Suo","Bai","Ge","Bo","Mao","Mu","Cui","Jian",2612 "San","Shu","Chang","Lu","Pu","Qu","Pie","Dao","Xian","Chuan","Dong","Ya","Yin","Ke","Yun","Fan",2613 "Chi","Jiao","Du","Die","You","Yuan","Guo","Yue","Wo","Rong","Huang","Jing","Ruan","Tai","Gong","Zhun",2614 "Na","Yao","Qian","Long","Dong","Ka","Lu","Jia","Shen","Zhou","Zuo","Gua","Zhen","Qu","Zhi","Jing",2615 "Guang","Dong","Yan","Kuai","Sa","Hai","Pian","Zhen","Mi","Tun","Luo","Cuo","Pao","Wan","Niao","Jing",2616 "Yan","Fei","Yu","Zong","Ding","Jian","Cou","Nan","Mian","Wa","E","Shu","Cheng","Ying","Ge","Lv",2617 "Bin","Teng","Zhi","Chuai","Gu","Meng","Sao","Shan","Lian","Lin","Yu","Xi","Qi","Sha","Xin","Xi",2618 "Biao","Sa","Ju","Sou","Biao","Biao","Shu","Gou","Gu","Hu","Fei","Ji","Lan","Yu","Pei","Mao",2619 "Zhan","Jing","Ni","Liu","Yi","Yang","Wei","Dun","Qiang","Shi","Hu","Zhu","Xuan","Tai","Ye","Yang",2620 "Wu","Han","Men","Chao","Yan","Hu","Yu","Wei","Duan","Bao","Xuan","Bian","Tui","Liu","Man","Shang",2621 "Yun","Yi","Yu","Fan","Sui","Xian","Jue","Cuan","Huo","Tao","Xu","Xi","Li","Hu","Jiong","Hu",2622 "Fei","Shi","Si","Xian","Zhi","Qu","Hu","Fu","Zuo","Mi","Zhi","Ci","Zhen","Tiao","Qi","Chan",2623 "Xi","Zhuo","Xi","Rang","Te","Tan","Dui","Jia","Hui","Nv","Nin","Yang","Zi","Que","Qian","Min",2624 "Te","Qi","Dui","Mao","Men","Gang","Yu","Yu","Ta","Xue","Miao","Ji","Gan","Dang","Hua","Che",2625 "Dun","Ya","Zhuo","Bian","Feng","Fa","Ai","Li","Long","Zha","Tong","Di","La","Tuo","Fu","Xing",2626 "Mang","Xia","Qiao","Zhai","Dong","Nao","Ge","Wo","Qi","Dui","Bei","Ding","Chen","Zhou","Jie","Di",2627 "Xuan","Bian","Zhe","Gun","Sang","Qing","Qu","Dun","Deng","Jiang","Ca","Meng","Bo","Kan","Zhi","Fu",2628 "Fu","Xu","Mian","Kou","Dun","Miao","Dan","Sheng","Yuan","Yi","Sui","Zi","Chi","Mou","Lai","Jian",2629 "Di","Suo","Ya","Ni","Sui","Pi","Rui","Sou","Kui","Mao","Ke","Ming","Piao","Cheng","Kan","Lin",2630 "Gu","Ding","Bi","Quan","Tian","Fan","Zhen","She","Wan","Tuan","Fu","Gang","Gu","Li","Yan","Pi",2631 "Lan","Li","Ji","Zeng","He","Guan","Juan","Jin","Ga","Yi","Po","Zhao","Liao","Tu","Chuan","Shan",2632 "Men","Chai","Nv","Bu","Tai","Ju","Ban","Qian","Fang","Kang","Dou","Huo","Ba","Yu","Zheng","Gu",2633 "Ke","Po","Bu","Bo","Yue","Mu","Tan","Dian","Shuo","Shi","Xuan","Ta","Bi","Ni","Pi","Duo",2634 "Kao","Lao","Er","You","Cheng","Jia","Nao","Ye","Cheng","Diao","Yin","Kai","Zhu","Ding","Diu","Hua",2635 "Quan","Ha","Sha","Diao","Zheng","Se","Chong","Tang","An","Ru","Lao","Lai","Te","Keng","Zeng","Li",2636 "Gao","E","Cuo","Lve","Liu","Kai","Jian","Lang","Qin","Ju","A","Qiang","Nuo","Ben","De","Ke",2637 "Kun","Gu","Huo","Pei","Juan","Tan","Zi","Qie","Kai","Si","E","Cha","Sou","Huan","Ai","Lou",2638 "Qiang","Fei","Mei","Mo","Ge","Juan","Na","Liu","Yi","Jia","Bin","Biao","Tang","Man","Luo","Yong",2639 "Chuo","Xuan","Di","Tan","Jue","Pu","Lu","Dui","Lan","Pu","Cuan","Qiang","Deng","Huo","Zhuo","Yi",2640 "Cha","Biao","Zhong","Shen","Cuo","Zhi","Bi","Zi","Mo","Shu","Lv","Ji","Fu","Lang","Ke","Ren",2641 "Zhen","Ji","Se","Nian","Fu","Rang","Gui","Jiao","Hao","Xi","Po","Die","Hu","Yong","Jiu","Yuan",2642 "Bao","Zhen","Gu","Dong","Lu","Qu","Chi","Si","Er","Zhi","Gua","Xiu","Luan","Bo","Li","Hu",2643 "Yu","Xian","Ti","Wu","Miao","An","Bei","Chun","Hu","E","Ci","Mei","Wu","Yao","Jian","Ying",2644 "Zhe","Liu","Liao","Jiao","Jiu","Yu","Hu","Lu","Guan","Bing","Ding","Jie","Li","Shan","Li","You",2645 "Gan","Ke","Da","Zha","Pao","Zhu","Xuan","Jia","Ya","Yi","Zhi","Lao","Wu","Cuo","Xian","Sha",2646 "Zhu","Fei","Gu","Wei","Yu","Yu","Dan","La","Yi","Hou","Chai","Lou","Jia","Sao","Chi","Mo",2647 "Ban","Ji","Huang","Biao","Luo","Ying","Zhai","Long","Yin","Chou","Ban","Lai","Yi","Dian","Pi","Dian",2648 "Qu","Yi","Song","Xi","Qiong","Zhun","Bian","Yao","Tiao","Dou","Ke","Yu","Xun","Ju","Yu","Yi",2649 "Cha","Na","Ren","Jin","Mei","Pan","Dang","Jia","Ge","Ken","Lian","Cheng","Lian","Jian","Biao","Chu",2650 "Ti","Bi","Ju","Duo","Da","Bei","Bao","Lv","Bian","Lan","Chi","Zhe","Qiang","Ru","Pan","Ya",2651 "Xu","Jun","Cun","Jin","Lei","Zi","Chao","Si","Huo","Lao","Tang","Ou","Lou","Jiang","Nou","Mo",2652 "Die","Ding","Dan","Ling","Ning","Guo","Kui","Ao","Qin","Han","Qi","Hang","Jie","He","Ying","Ke",2653 "Han","E","Zhuan","Nie","Man","Sang","Hao","Ru","Pin","Hu","Qian","Qiu","Ji","Chai","Hui","Ge",2654 "Meng","Fu","Pi","Rui","Xian","Hao","Jie","Gong","Dou","Yin","Chi","Han","Gu","Ke","Li","You",2655 "Ran","Zha","Qiu","Ling","Cheng","You","Qiong","Jia","Nao","Zhi","Si","Qu","Ting","Kuo","Qi","Jiao",2656 "Yang","Mou","Shen","Zhe","Shao","Wu","Li","Chu","Fu","Qiang","Qing","Qi","Xi","Yu","Fei","Guo",2657 "Guo","Yi","Pi","Tiao","Quan","Wan","Lang","Meng","Chun","Rong","Nan","Fu","Kui","Ke","Fu","Sou",2658 "Yu","You","Lou","You","Bian","Mou","Qin","Ao","Man","Mang","Ma","Yuan","Xi","Chi","Tang","Pang",2659 "Shi","Huang","Cao","Piao","Tang","Xi","Xiang","Zhong","Zhang","Shuai","Mao","Peng","Hui","Pan","Shan","Huo",2660 "Meng","Chan","Lian","Mie","Li","Du","Qu","Fou","Ying","Qing","Xia","Shi","Zhu","Yu","Ji","Du",2661 "Ji","Jian","Zhao","Zi","Hu","Qiong","Po","Da","Sheng","Ze","Gou","Li","Si","Tiao","Jia","Bian",2662 "Chi","Kou","Bi","Xian","Yan","Quan","Zheng","Jun","Shi","Gang","Pa","Shao","Xiao","Qing","Ze","Qie",2663 "Zhu","Ruo","Qian","Tuo","Bi","Dan","Kong","Wan","Xiao","Zhen","Kui","Huang","Hou","Gou","Fei","Li",2664 "Bi","Chi","Su","Mie","Dou","Lu","Duan","Gui","Dian","Zan","Deng","Bo","Lai","Zhou","Yu","Yu",2665 "Chong","Xi","Nie","Nv","Chuan","Shan","Yi","Bi","Zhong","Ban","Fang","Ge","Lu","Zhu","Ze","Xi",2666 "Shao","Wei","Meng","Shou","Cao","Chong","Meng","Qin","Niao","Jia","Qiu","Sha","Bi","Di","Qiang","Suo",2667 "Jie","Tang","Xi","Xian","Mi","Ba","Li","Tiao","Xi","Zi","Can","Lin","Zong","San","Hou","Zan",2668 "Ci","Xu","Rou","Qiu","Jiang","Gen","Ji","Yi","Ling","Xi","Zhu","Fei","Jian","Pian","He","Yi",2669 "Jiao","Zhi","Qi","Qi","Yao","Dao","Fu","Qu","Jiu","Ju","Lie","Zi","Zan","Nan","Zhe","Jiang",2670 "Chi","Ding","Gan","Zhou","Yi","Gu","Zuo","Tuo","Xian","Ming","Zhi","Yan","Shai","Cheng","Tu","Lei",2671 "Kun","Pei","Hu","Ti","Xu","Hai","Tang","Lao","Bu","Jiao","Xi","Ju","Li","Xun","Shi","Cuo",2672 "Dun","Qiong","Xue","Cu","Bie","Bo","Ta","Jian","Fu","Qiang","Zhi","Fu","Shan","Li","Tuo","Jia",2673 "Bo","Tai","Kui","Qiao","Bi","Xian","Xian","Ji","Jiao","Liang","Ji","Chuo","Huai","Chi","Zhi","Dian",2674 "Bo","Zhi","Jian","Die","Chuai","Zhong","Ju","Duo","Cuo","Pian","Rou","Nie","Pan","Qi","Chu","Jue",2675 "Pu","Fan","Cu","Zhu","Lin","Chan","Lie","Zuan","Xie","Zhi","Diao","Mo","Xiu","Mo","Pi","Hu",2676 "Jue","Shang","Gu","Zi","Gong","Su","Zhi","Zi","Qing","Liang","Yu","Li","Wen","Ting","Ji","Pei",2677 "Fei","Sha","Yin","Ai","Xian","Mai","Chen","Ju","Bao","Tiao","Zi","Yin","Yu","Chuo","Wo","Mian",2678 "Yuan","Tuo","Zhui","Sun","Jun","Ju","Luo","Qu","Chou","Qiong","Luan","Wu","Zan","Mou","Ao","Liu",2679 "Bei","Xin","You","Fang","Ba","Ping","Nian","Lu","Su","Fu","Hou","Tai","Gui","Jie","Wei","Er",2680 "Ji","Jiao","Xiang","Xun","Geng","Li","Lian","Jian","Shi","Tiao","Gun","Sha","Huan","Ji","Qing","Ling",2681 "Zou","Fei","Kun","Chang","Gu","Ni","Nian","Diao","Shi","Zi","Fen","Die","E","Qiu","Fu","Huang",2682 "Bian","Sao","Ao","Qi","Ta","Guan","Yao","Le","Biao","Xue","Man","Min","Yong","Gui","Shan","Zun",2683 "Li","Da","Yang","Da","Qiao","Man","Jian","Ju","Rou","Gou","Bei","Jie","Tou","Ku","Gu","Di",2684 "Hou","Ge","Ke","Bi","Lou","Qia","Kuan","Bin","Du","Mei","Ba","Yan","Liang","Xiao","Wang","Chi",2685 "Xiang","Yan","Tie","Tao","Yong","Biao","Kun","Mao","Ran","Tiao","Ji","Zi","Xiu","Quan","Jiu","Bin",2686 "Huan","Lie","Me","Hui","Mi","Ji","Jun","Zhu","Mi","Qi","Ao","She","Lin","Dai","Chu","You",2687 "Xia","Yi","Qu","Du","Li","Qing","Can","An","Fen","You","Wu","Yan","Xi","Qiu","Han","Zha"2688 };2689 #endregion 二级汉字2690 #region 变量定义2691 // GB2312-80 标准规范中第一个汉字的机内码.即"啊"的机内码2692 private const int firstChCode = -20319;2693 // GB2312-80 标准规范中最后一个汉字的机内码.即"齄"的机内码2694 private const int lastChCode = -2050;2695 // GB2312-80 标准规范中最后一个一级汉字的机内码.即"座"的机内码2696 private const int lastOfOneLevelChCode = -10247;2697 // 配置中文字符2698 //static Regex regex = new Regex("[\u4e00-\u9fa5]$");2699 2700 #endregion2701 #endregion2702 2703 /// <summary>2704 /// 取拼音第一个字段2705 /// </summary> 2706 /// <param name="ch"></param> 2707 /// <returns></returns> 2708 public static String GetFirst(Char ch) 2709 {2710 var rs = Get(ch); 2711 if (!String.IsNullOrEmpty(rs)) rs = rs.Substring(0, 1); 2712 2713 return rs; 2714 }2715 2716 /// <summary>2717 /// 取拼音第一个字段2718 /// </summary>2719 /// <param name="str"></param>2720 /// <returns></returns>2721 public static String GetFirst(String str)2722 {2723 if (String.IsNullOrEmpty(str)) return String.Empty; 2724 2725 var sb = new StringBuilder(str.Length + 1); 2726 var chs = str.ToCharArray(); 2727 2728 for (var i = 0; i < chs.Length; i++) 2729 { 2730 sb.Append(GetFirst(chs[i]));2731 } 2732 2733 return sb.ToString();2734 }2735 2736 /// <summary>2737 /// 获取单字拼音2738 /// </summary>2739 /// <param name="ch"></param>2740 /// <returns></returns>2741 public static String Get(Char ch)2742 {2743 // 拉丁字符 2744 if (ch <= ‘\x00FF‘) return ch.ToString();2745 2746 // 标点符号、分隔符 2747 if (Char.IsPunctuation(ch) || Char.IsSeparator(ch)) return ch.ToString();2748 2749 // 非中文字符 2750 if (ch < ‘\x4E00‘ || ch > ‘\x9FA5‘) return ch.ToString();2751 2752 var arr = Encoding.GetEncoding("gb2312").GetBytes(ch.ToString());2753 //Encoding.Default默认在中文环境里虽是GB2312,但在多变的环境可能是其它2754 //var arr = Encoding.Default.GetBytes(ch.ToString()); 2755 var chr = (Int16)arr[0] * 256 + (Int16)arr[1] - 65536;2756 2757 //***// 单字符--英文或半角字符 2758 if (chr > 0 && chr < 160) return ch.ToString();2759 #region 中文字符处理2760 2761 // 判断是否超过GB2312-80标准中的汉字范围2762 if (chr > lastChCode || chr < firstChCode)2763 {2764 return ch.ToString();;2765 }2766 // 如果是在一级汉字中2767 else if (chr <= lastOfOneLevelChCode)2768 {2769 // 将一级汉字分为12块,每块33个汉字.2770 for (int aPos = 11; aPos >= 0; aPos--)2771 {2772 int aboutPos = aPos * 33;2773 // 从最后的块开始扫描,如果机内码大于块的第一个机内码,说明在此块中2774 if (chr >= pyValue[aboutPos])2775 {2776 // Console.WriteLine("存在于第 " + aPos.ToString() + " 块,此块的第一个机内码是: " + pyValue[aPos * 33].ToString());2777 // 遍历块中的每个音节机内码,从最后的音节机内码开始扫描,2778 // 如果音节内码小于机内码,则取此音节2779 for (int i = aboutPos + 32; i >= aboutPos; i--)2780 {2781 if (pyValue[i] <= chr)2782 {2783 // Console.WriteLine("找到第一个小于要查找机内码的机内码: " + pyValue[i].ToString());2784 return pyName[i];2785 }2786 }2787 break;2788 }2789 }2790 }2791 // 如果是在二级汉字中2792 else2793 {2794 int pos = Array.IndexOf(otherChinese, ch.ToString());2795 if (pos != decimal.MinusOne)2796 {2797 return otherPinYin[pos];2798 }2799 }2800 #endregion 中文字符处理2801 2802 //if (chr < -20319 || chr > -10247) { // 不知道的字符 2803 // return null; 2804 2805 //for (var i = pyValue.Length - 1; i >= 0; i--)2806 //{ 2807 // if (pyValue[i] <= chr) return pyName[i];//这只能对应数组已经定义的 2808 //} 2809 2810 return String.Empty;2811 }2812 2813 /// <summary>2814 /// 把汉字转换成拼音(全拼)2815 /// </summary>2816 /// <param name="str">汉字字符串</param>2817 /// <returns>转换后的拼音(全拼)字符串</returns>2818 public static String GetPinYin(String str)2819 {2820 if (String.IsNullOrEmpty(str)) return String.Empty; 2821 2822 var sb = new StringBuilder(str.Length * 10); 2823 var chs = str.ToCharArray(); 2824 2825 for (var j = 0; j < chs.Length; j++) 2826 { 2827 sb.Append(Get(chs[j])); 2828 } 2829 2830 return sb.ToString();2831 }2832 #endregion2833 2834 #region 获取网页的HTML内容2835 // 获取网页的HTML内容,指定Encoding2836 public static string GetHtml(string url, Encoding encoding)2837 {2838 byte[] buf = new WebClient().DownloadData(url);2839 if (encoding != null) return encoding.GetString(buf);2840 string html = Encoding.UTF8.GetString(buf);2841 encoding = GetEncoding(html);2842 if (encoding == null || encoding == Encoding.UTF8) return html;2843 return encoding.GetString(buf);2844 }2845 // 根据网页的HTML内容提取网页的Encoding2846 public static Encoding GetEncoding(string html)2847 {2848 string pattern = @"(?i)\bcharset=(?<charset>[-a-zA-Z_0-9]+)";2849 string charset = Regex.Match(html, pattern).Groups["charset"].Value;2850 try { return Encoding.GetEncoding(charset); }2851 catch (ArgumentException) { return null; }2852 }2853 #endregion2854 }2855 }
帮助类下
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。