c# iconfont在后端添加前端显示

public string UnicodeToStr(string unicodeStr)
        {
            string outStr = "";
            if (!string.IsNullOrEmpty(unicodeStr))
            {
                string[] strlist = unicodeStr.Replace("&#", "").Replace(";", "").Split('x');
                try
                {
                    for (int i = 1; i < strlist.Length; i++)
                    {
                        outStr += (char)int.Parse(strlist[i], System.Globalization.NumberStyles.HexNumber);
                    }
                }
                catch (FormatException ex)
                {
                    outStr = ex.Message;
                }
            }
            return outStr;
        }

  

//调用
UnicodeToStr("") 

  

 

posted @ 2023-06-07 21:32  1014040868a  阅读(41)  评论(0编辑  收藏  举报