Javascript \u003C 是什么意思?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4858494/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does \u003C mean?
提问by Blankman
I'm looking at twitter's javascript file, and I see this in the templates hash:
我正在查看 twitter 的 javascript 文件,我在模板哈希中看到了这一点:
Browse Interests{{/i}}\u003C/a\u003E\n \u003C/li\u003E\n {{#logged_in}}\n
What do those codes represent?
这些代码代表什么?
回答by Raynos
回答by jhartz
That is a unicode character code that, when parsed by JavaScript as a string, is converted into its corresponding character (JavaScript automatically converts any occurrences of \uXXXX
into the corresponding Unicode character). For example, your example would be:
这是一个 unicode 字符代码,当被 JavaScript 解析为字符串时,它会被转换为其相应的字符(JavaScript 会自动将任何出现的\uXXXX
转换为相应的 Unicode 字符)。例如,您的示例是:
Browse Interests{{/i}}</a>\n </li>\n {{#logged_in}}\n
As you can see, \u003C
changes into <
(less-than sign) and \u003E
changes into >
(greater-than sign).
如您所见,\u003C
变为<
(小于号)和\u003E
变为>
(大于号)。
In addition to the link posted by Raynos, this page from the Unicode websitelists a lot of characters (so many that they decided to annoyingly group them) and this pagehas a (kind of) nice index.
除了 Raynos 发布的链接之外,Unicode 网站的这个页面还列出了很多字符(太多了,以至于他们决定烦人地将它们分组),并且这个页面有一个(某种)不错的索引。
回答by Neil
It is a unicode char \u003C = <
它是一个 Unicode 字符 \u003C = <
回答by amurra
Those are unicode escapes. The general unicode escapes looks like \uxxxx
where xxxx
are the hexadecimal digits of the ASCI characters. They are used mainly to insert special characters inside a javascript string.
这些是unicode转义。一般的 unicode 转义看起来像ASCI 字符的十六进制数字\uxxxx
在哪里xxxx
。它们主要用于在 javascript 字符串中插入特殊字符。