I am learning Julia for my next project because the data really text-heavy and we are looking into making the code run more efficiently and fast. So as experimentation, I am learning Julia.
Now I learned that there is a really nice way to enter the Unicode characters in Julia. For example:
"⎔"
can be made using "\hexagon"+tab
Is there a way to get back the textual version of these Unicode characters?
So what I am kind of asking is:
For each of these:
("⬙", "☽", "⎔", "⬟", "◁")
Can I get back:
("diamondbotblack", "rightmoon", "hexagon", "pentagonblack", "triangleleft")
Since we can't save them along with the \
like \pentagon
because flags it as: syntax: invalid escape sequence
, it's perfectly fine if I can get back an array of strings without \
.
Anyone have any idea how to do it? I've already googled this and searched on Stackoverflow, posted in one of the forum too, didn't find any solution yet.
You can use this:
using REPL
tmp_d = REPL.REPLCompletions.latex_symbols
mapping = Dict(values(tmp_d) .=> keys(tmp_d))
and now you can do:
julia> map(v -> mapping[v], ("⬙", "☽", "⎔", "⬟", "◁"))
("\\diamondbotblack", "\\rightmoon", "\\hexagon", "\\pentagonblack", "\\triangleleft")
I left the leading "\\"
, but you can remove it if you prefer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With