Difference between revisions of "Str.tohex"

From OpenEUO
Jump to: navigation, search
(Created page with "== 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...")
 
(No difference)

Latest revision as of 10:55, 24 November 2010

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