e2 docs string - wiremod/wire GitHub Wiki

Jump to table of contents

String

Number = String:toNumber()

Parses a number from a string (20 ops)

Number = String:toNumber(Number Base)

Parses a number from a string. The argument given is the base. I.e. toNumber(16) will parse hex (20 ops)

String = toChar(Number)

Returns a one-character string from it's ASCII code, where 32 = argument 1 = 255. An empty string is returned for numbers outside that range (20 ops)

Number = toByte(String)

Returns the ASCII code of the 1st character in the string (20 ops)

Number = toByte(String, Number)

Returns the ASCII code of the Nth character in the string (20 ops)

String = toUnicodeChar(Number)

Returns a one-character string from it's UNICODE code (20 ops)

Number = toUnicodeByte(String)

Returns the Unicode code of the 1st character in the string (20 ops)

String = String:index(Number)

Returns Nth letter of the string, formatted as a string (20 ops)

String = String:left(Number)

Returns N amount of characters starting from the leftmost character (20 ops)

String = String:right(Number)

Returns N amount of characters starting from the rightmost character (20 ops)

String = String:sub(Number, Number)

Returns a substring, starting at the first number argument and ending at the second (20 ops)

String = String:sub(Number Start)

Returns a substring, starting at the number argument and ending at the end of the string (20 ops)

String = String:upper()

All characters are made uppercase (20 ops)

String = String:lower()

All characters are made lowercase (20 ops)

Number = String:length()

Returns the length of the string (20 ops)

Number = String:unicodeLength()

Returns the unicode length of the string (20 ops)

String = String:repeat(Number)

Repeats the input string N times (20 ops)

String = String:trim()

Trims away spaces at the beginning and end of a string (20 ops)

String = String:trimLeft()

Trims away opening spaces on the string (20 ops)

String = String:trimRight()

Trims away spaces at the end of a string (20 ops)

Number = String:findRE(String Pattern)

Returns the 1st occurrence of the string S using REGEX functions, returns 0 if not found (20 ops)

Number = String:findRE(String Pattern, Number Start)

Returns the 1st occurrence of the string S starting at N and going to the end of the string using REGEX functions, returns 0 if not found (20 ops)

Number = String:find(String Needle)

Returns the 1st occurrence of the string S, returns 0 if not found (20 ops)

Number = String:find(String Needle, Number Start)

Returns the 1st occurrence of the string S starting at N and going to the end of the string, returns 0 if not found (20 ops)

String = String:replace(String Needle, String New)

Finds and replaces every occurrence of the first argument with the second argument (20 ops)

String = String:replaceRE(String Pattern, String New)

Finds and replaces every occurrence of the first argument using REGEX with the second argument (20 ops)

Array = String:explode(String Delim)

Splits the string into an array, along the boundaries formed by the string S. See also String.Explode (5 ops)

Array = String:explodeRE(String Delim)

Splits the string into an array, along the boundaries formed by the string pattern S. See also String.Explode (5 ops)

String = String:reverse()

Returns a reversed version of S (10 ops)

String = format(String Fmt, ...)

Formats a values exactly like Lua's [http://www.lua.org/manual/5.1/manual.html#pdf-string.format string.format]. Any number and type of parameter can be passed through the "...". Prints errors to the chat area (10 ops)

Array = String:match(String Pattern)

runs string.match(S, S2) and returns the sub-captures as an array (10 ops)

Array = String:match(String Pattern, Number Position)

runs string.match(S, S2, N) and returns the sub-captures as an array (10 ops)

Table = String:gmatch(String Pattern)

runs string.gmatch(S, S2) and returns the captures in arrays in a table (10 ops)

Table = String:gmatch(String Pattern, Number Position)

runs string.gmatch(S, S2, N) and returns the captures in arrays in a table (10 ops)

String = String:matchFirst(String Pattern)

runs string.match(S, S2) and returns the first match or an empty string if the match failed (10 ops)

String = String:matchFirst(String Pattern, Number Position)

runs string.match(S, S2, N) and returns the first match or an empty string if the match failed (10 ops)

String = toUnicodeChar(...)

Returns the UTF-8 string from the given Unicode code-points (1 ops)

String = toUnicodeChar(Array Args)

Returns the UTF-8 string from the given Unicode code-points (1 ops)

Array = String:toUnicodeByte(Number Startpos, Number Endpos)

Returns the Unicode code-points from the given UTF-8 string (1 ops)

Number = String:unicodeLength(Number Startpos, Number Endpos)

Returns the length of the given UTF-8 string (1 ops)