Unicode字符的名称

Luc*_*nti 3 unicode julia

在julia 0.6中有可能通过其名称获得unicode字符吗?

在python中,它可以做到

s = u'\N{SECTION SIGN}'
Run Code Online (Sandbox Code Playgroud)

有什么相似之处?我知道我能做到

s =  '\u00a3'
Run Code Online (Sandbox Code Playgroud)

但我想通过名字来做.

谢谢

Lyn*_*ite 5

StringLiterals.jl允许您执行此操作.

通过 s = f"\N{SECTION SIGN}"

StringLiterals.jl刚刚注册了.你可以通过安装它Pkg.add("StringLiterals")

例子

julia> using StringLiterals

julia> s = f"\N{SECTION SIGN}" #Unicode Entity
"§"

julia> f"\N{SNOWMAN}" #Unicode Entity
"?"

julia> f"\:mage:" #Emoji Entity 
"\U1f9d9"

julia> f"\<sun>" #LaTeX Entity
"?"

julia> f"\&euro;" # HTML Entity
"€"
Run Code Online (Sandbox Code Playgroud)