Main Content

hex

Convert UTF-32 representation to hexadecimal values

Since R2021a

    Description

    example

    hexStr = hex(str32) converts the UTF-32 representation str32 to hexadecimal values.

    Examples

    collapse all

    Convert the string "Hello! 😀" to its Unicode UTF-32 string representation using the textanalytics.unicode.UTF32 function.

    str = "Hello! 😀";
    str32 = textanalytics.unicode.UTF32(str)
    str32 = 
      UTF32 with properties:
    
        Data: [72 101 108 108 111 33 32 128512]
    
    

    Convert str32 to hexadecimal values using the hex function.

    hexStr = hex(str32)
    hexStr = 
    " 0048  0065  006C  006C  006F  0021  0020 1F600"
    

    Input Arguments

    collapse all

    UTF-32 string representation, specified as a UTF32 array.

    Output Arguments

    collapse all

    Hexadecimal values, returned as a string array.

    The output hexStr is a string array with the same size as str32, where hexStr(i) is a string containing the hexadecimal values corresponding to the str32(i) separated by whitespace characters.

    Version History

    Introduced in R2021a