从十六进制字符串表示形式中创建RAW UNICODE字符
给定一个Unicode字符的字符串十六进制表示,我想打印其代表的Unicode字符
julia> s1, s2 = raw"\u0041", raw"\x41"
julia> println(s1,' ', s2)
\u0041 \x41
,我希望它打印“ A” A'
用例: 对于演示,我想循环多个值,并将地图从十六进制表示到Unicode:
for ii = 0x0021 : 0x007f
hex_rep = string(ii, base=16)
unicode = raw"\u" * lpad(hex_rep, 4, '0')
println(hex_rep, " -> ", unicode)
end
Given the string hex representation of a Unicode character, I would like to print the Unicode character it represents
julia> s1, s2 = raw"\u0041", raw"\x41"
julia> println(s1,' ', s2)
\u0041 \x41
Instead, I want it to print "A A"
Use Case:
For a demo, I would like to loop over a range of values and print a map from the hex representation to the Unicode:
for ii = 0x0021 : 0x007f
hex_rep = string(ii, base=16)
unicode = raw"\u" * lpad(hex_rep, 4, '0')
println(hex_rep, " -> ", unicode)
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以这样做:
对于其他情况,请考虑使用上述
unescape_string
You can just do:
For other cases consider using the forementioned
unescape_string