简体   繁体   English

JavaScript转义序列

[英]JavaScript escape sequence

I am currently trying to translate a short bit of JavaScript code into Java. 我目前正在尝试将一小段JavaScript代码转换为Java。 But since I never did anything with JavaScript, I have trouble translating this line: 但是由于我从不使用JavaScript进行任何操作,因此在翻译这一行时遇到了麻烦:

key += "\x720\\x78X";

Can someone help me understanding or translating this? 有人可以帮助我理解或翻译吗?

Honestly, it is hard to say because that line seems incorrect: it is trying to append characters to the existing value stored in key by using Hexadecimal escape sequences , but only 2 digits are allowed in a hex sequence, so "\\x720\\\\x78X" is translated to "r0\\x78X" : 老实说,很难说,因为该行似乎是不正确的:它试图通过使用十六进制转义序列将字符追加到存储在key的现有值,但是十六进制序列中只允许两位数字,因此"\\x720\\\\x78X"被翻译为"r0\\x78X"

"\\x72" is "r" then, you have "0" , then there is a escaped inversed slash "\\\\" , that means "\\" and then you have "x78X" "\\x72""r"那么您有"0" ,然后有一个转义的反斜杠"\\\\" ,表示"\\" ,然后您有"x78X"

If you write "\\x72\\x78" you will obtain "rx" 如果您输入"\\x72\\x78" ,则将获得"rx"

I hope this helps you to understand that piece of code... 我希望这可以帮助您理解这段代码...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM