转换汉子首字母类 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,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。