Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unicode character by name

Tags:

unicode

julia

It is possible in julia 0.6 obtain the unicode character by its name?

In python it is possible by doing

s = u'\N{SECTION SIGN}'

There is something alike? I know I can do

s =  '\u00a3'

but I want to do it by name.

Thank you

like image 889
Luciano Lorenti Avatar asked Apr 09 '26 14:04

Luciano Lorenti


1 Answers

StringLiterals.jl lets you do this.

via s = f"\N{SECTION SIGN}"

StringLiterals.jl was just registered the other day. You can install it via Pkg.add("StringLiterals")

Examples

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
"€"
like image 175
Lyndon White Avatar answered Apr 11 '26 18:04

Lyndon White



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!