Str.tohex

From OpenEUO
Jump to: navigation, search

Calling Pattern

Call

local b = sl.str.tohex(a)

Args

a is a string

Results

b is a string consisting only of hexadecimal characters

Usage Example

local s = sl.str
local a = s.tohex('One converted string.')
local r = s.fromhex(a)
print(a)
print(r)
--> 4f6e6520636f6e76657274656420737472696e672e
    One converted string.

Description

Encodes a string as a sequence of hexadecimal characters. String can contain control characters.

Upon Error

Tohex fails silently. If tohex receives no argument, then '' (an empty string) is returned.

See Also