Search code examples
stringunicodejuliahexcodepoint

What is a syntax for generating the Unicode hexadecimal value of a character in Julia as a `String`?


What is a syntax for generating the Unicode hexadecimal value of a character in Julia as a String?

To generate the Unicode hexadecimal value of a character <char> as a UInt32, one can execute codepoint('<char>').

Example

julia> codepoint('α')
0x000003b1


Solution

  • The codepoint of a character <char>, in hexadecimal integer representation, as a String type, can be found by string(Int('<char>'), base=16).

    Example

    julia> string(Int('α'), base=16)
    "3b1"