转换汉子首字母类 CreatChinaSpell

转换汉子首字母类 CreatChinaSpell
 public class CreatChinaSpell
    {
        public static string GetChineseFirstChar(string chineseStr)
        {
            StringBuilder sb = new StringBuilder();
            int length = chineseStr.Length;
            for (int i = 0; i < length; i++)
            {
                string chineseChar = chineseStr.Substring(i, 1);
                sb.Append(GetpyChar(chineseChar));
            }
            return sb.ToString();
        }

        private static string GetpyChar(string chineseChar)
        {
            string result = string.Empty;

            if (chineseChar.CompareTo("") >= 0)
            {
                result = "Z";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "Y";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "X";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "W";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "T";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "S";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "R";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "Q";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "P";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "O";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "N";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "M";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "L";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "K";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "J";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "H";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "G";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "F";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "E";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "D";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "C";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "B";
            }
            else if (chineseChar.CompareTo("") >= 0)
            {
                result = "A";
            }
            else
            {
                result = chineseChar.ToUpper();
            }

            return result;
        }
    } 
转换汉子首字母类 CreatChinaSpell

 

转换汉子首字母类 CreatChinaSpell,布布扣,bubuko.com

转换汉子首字母类 CreatChinaSpell

上一篇:精选29款非常实用的jQuery应用插件


下一篇:Oracle 笔记:PLSQL无法连接64位Oracle 解决方法