I want to define a constant string as following:
"Hello World$1F"
Where the '$1F' is the ASCII hex code.
Your help is highly appreciated.
你要找的是:
"Hello World\u001F"
Java String, char, Character use the UTF-16 encoding of the Unicode character set. (Just in like JavaScript, .NET, VB4, NCHAR, NVARCHAR, ….) Any similarity to ASCII is rarely relevant.
So, by $1F you must mean the Unicode codepoint U+001F , which is represented in a String literal as the single UTF-16 code unit "\". (Note: You can visualize it using a control picture character ␟, too.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.