Skip to main content

Convert from hex string (string.from_hex)

Declaration​

data = string.from_hex(hex_text)

Parameters​

  • hex_text
    string. Hex text to be converted back to string.

Returns​

  • data
    string or nil. Returns the converted string. If input is not valid hex, returns nil.

Description​

The inverse of string.to_hex. Convert printable hex text back to string (or binary data).

Example​

sys.alert(string.from_hex('e4b880e4ba9be695b0e68dae'))
-- "一些数据"

Note: Uses function outside of this chapter: sys.alert

More examples​

At the end of this chapter