使用\ u转义时得到编译错误 [英] Got compile error when using \U escape

查看:132
本文介绍了使用\ u转义时得到编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用\ U代表UNI code文字时,得到了一个编译错误无法识别的转义序列,有什么错我的计划?

 公共类TestProject的
{

静态无效的主要(字串[] args)
{
  字符串S1 =\ UD800DC09;
  Console.WriteLine(S1);
}
}
 

解决方案

请参阅本的 MSDN文章。它说:统一code字符0x10FFFF以上code点不支持。

修改: 可能是你想要的是:

 字符串S1 =\ uD800 \ uDC09;
 

I got a compile error 'unrecognized escape sequence' when using \U for unicode literal, is there anything wrong with my program?

  public class TestProject
{

static void Main(string[] args)
{
  string s1 = "\UD800DC09";
  Console.WriteLine(s1);
}
}

解决方案

See this msdn article. It says: "Unicode characters with code points above 0x10FFFF are not supported."

EDIT: May be what you want is:

string s1 = "\uD800\uDC09"; 

这篇关于使用\ u转义时得到编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆