Invalid escape sequence in literal [duplicate]

匿名 (未验证) 提交于 2019-12-03 10:10:24

问题:

This question already has an answer here:

Suppose to be a easy one

I get a compiler error for this:

var str:String = "117\/7024" 

I gauss i have a problem with either / but i cant find an answer how to correct this String

回答1:

Looks like you are trying to re-define str which you might have defined before yourself. I would not recommend this type of variable name, even if it is legal.

Also, you need to leave a space after the =.

EDIT: Your original question quoted the string as "117/7024", which does not give this error. I suppose you meant to write "117\7024".

To escape a backslash, use "117\\7024".
"177\u{7024}".



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!