/// <summary>
        
/// 把四个字符长度的Unicode转成对应的汉字
        
/// </summary>
        
/// <param name="str">长度是4的Unicode</param>
        
/// <returns>对应的汉字,若转换出错则返回原字符串</returns>
        private string Unicode2UnitCharacter(string str)
        {
            if (str.Length != 4)
            {
                return str;
            }

            try
            {
                byte code = System.Convert.ToByte(str.Substring(02), 16);
                byte code2 = System.Convert.ToByte(str.Substring(2), 16);
                return System.Text.Encoding.Unicode.GetString(new byte[] { code2, code });
            }
            catch (Exception)
            {
                return str;
            }

原文

相关文章:

  • 2022-12-23
  • 2022-01-24
  • 2021-11-25
  • 2022-01-14
  • 2022-01-20
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2021-06-23
  • 2022-12-23
  • 2021-11-28
相关资源
相似解决方案