static void Main(string[] args)
        {
            string a = "abcdefg";
            string b = "abcdefg中华人民共和国";
            Console.WriteLine(System.Text.Encoding.Default.GetBytes(a).Length);
            Console.WriteLine(System.Text.Encoding.Default.GetBytes(b).Length);
        }

 

输出:

7

21

相关文章:

  • 2022-12-23
  • 2021-07-20
  • 2022-12-23
  • 2022-12-23
  • 2022-02-26
  • 2021-09-24
  • 2022-12-23
猜你喜欢
  • 2021-06-05
  • 2022-12-23
  • 2021-10-28
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
相关资源
相似解决方案