火星文转换

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

火星文转换_第1张图片 

#region 火星文转换
            string[] cn = HXW.Split(new char[] {','},StringSplitOptions.RemoveEmptyEntries);
            Hashtable ht = new Hashtable();
            for (int i = 0; i < cn.Length; i++)
            {
             
                if (!ht.ContainsKey(cn[i][0]))
                {
                    ht.Add(cn[i][0],cn[i].Substring(1));
                }
              
            }
            string content = "曾经沧海难为水,除却巫山不是云.取次花丛懒回顾,半缘修道半缘君.";
            string str = "";
            for (int i = 0; i < content.Length; i++)
            {
                if (ht.ContainsKey(content[i]))
                {
                    Console.Write(ht[content[i]]);
                }
                else
                {
                    Console.Write(content[i]);
                }
            }


            #endregion


原文链接: http://blog.csdn.net/mypc2010/article/details/8027084

转载于:https://my.oschina.net/changpinghu/blog/92508

你可能感兴趣的:(火星文转换)