e2 docs string - wiremod/wire GitHub Wiki
String
=
:toNumber()
Parses a number from a string (2 ops)
=
:toNumber(
Base)
Parses a number from a string. The argument given is the base. I.e. toNumber(16) will parse hex (2 ops)
= toChar(
N)
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 (1 ops)
= toByte(
C)
Returns the ASCII code of the 1st character in the string (1 ops)
= toByte(
Str,
Idx)
Returns the ASCII code of the Nth character in the string (1 ops)
= toUnicodeChar(
Byte)
Returns a one-character string from it's UNICODE code (5 ops)
= toUnicodeByte(
C)
Returns the Unicode code of the 1st character in the string (5 ops)
=
:index(
Idx)
Returns Nth letter of the string, formatted as a string (1 ops)
=
:left(
Idx)
Returns N amount of characters starting from the leftmost character (1 ops)
=
:right(
Idx)
Returns N amount of characters starting from the rightmost character (1 ops)
=
:sub(
Start,
Finish)
Returns a substring, starting at the first number argument and ending at the second (1 ops)
=
:sub(
Start)
Returns a substring, starting at the number argument and ending at the end of the string (1 ops)
=
:upper()
All characters are made uppercase (1 ops)
=
:lower()
All characters are made lowercase (1 ops)
=
:length()
Returns the length of the string (1 ops)
=
:unicodeLength()
Returns the unicode length of the string (10 ops)
=
:repeat(
Times)
Repeats the input string N times (3 ops)
=
:trim()
Trims away spaces at the beginning and end of a string (2 ops)
=
:trimLeft()
Trims away opening spaces on the string (2 ops)
=
:trimRight()
Trims away spaces at the end of a string (2 ops)
=
:findRE(
Pattern)
Returns the 1st occurrence of the string S using REGEX functions, returns 0 if not found (10 ops)
=
:findRE(
Pattern,
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 (10 ops)
=
:find(
Needle)
Returns the 1st occurrence of the string S, returns 0 if not found (6 ops)
=
:find(
Needle,
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 (6 ops)
=
:replace(
Needle,
New)
Finds and replaces every occurrence of the first argument with the second argument (8 ops)
=
:replaceRE(
Pattern,
New)
Finds and replaces every occurrence of the first argument using REGEX with the second argument (12 ops)
=
:explode(
Delim)
Splits the string into an array, along the boundaries formed by the string S. See also String.Explode (2 ops)
=
:explodeRE(
Delim)
Splits the string into an array, along the boundaries formed by the string pattern S. See also String.Explode (5 ops)
=
:reverse()
Returns a reversed version of S (6 ops)
= format(
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 (3 ops)
=
:match(
Pattern)
runs string.match(S, S2) and returns the sub-captures as an array (10 ops)
=
:match(
Pattern,
Position)
runs string.match(S, S2, N) and returns the sub-captures as an array (10 ops)
=
:gmatch(
Pattern)
runs string.gmatch(S, S2) and returns the captures in arrays in a table (12 ops)
=
:gmatch(
Pattern,
Position)
runs string.gmatch(S, S2, N) and returns the captures in arrays in a table (12 ops)
=
:matchFirst(
Pattern)
runs string.match(S, S2) and returns the first match or an empty string if the match failed (10 ops)
=
:matchFirst(
Pattern,
Position)
runs string.match(S, S2, N) and returns the first match or an empty string if the match failed (10 ops)
= toUnicodeChar(...)
Returns the UTF-8 string from the given Unicode code-points (3 ops)
= toUnicodeChar(
Args)
Returns the UTF-8 string from the given Unicode code-points (3 ops)
=
:toUnicodeByte(
Startpos,
Endpos)
Returns the Unicode code-points from the given UTF-8 string (3 ops)
=
:unicodeLength(
Startpos,
Endpos)
Returns the length of the given UTF-8 string (3 ops)
= compress(
Plaintext)
Compresses the input string using LZMA compression. See decompress(string) (10 ops)
= decompress(
Compressed)
Decompresses an LZMA-compressed string. See compress(string) (10 ops)
= hashCRC(
Text)
Returns a the CRC checksum of the input string. This is not a secure hash function (5 ops)
= hashMD5(
Text)
Returns the MD5 hash of the input string. This is not a secure hash function; see hashSHA256 (5 ops)
= hashSHA1(
Text)
Returns the SHA1 hash of the input string. This is not a secure hash function; see hashSHA256 (5 ops)
= hashSHA256(
Text)
Returns the SHA256 hash of the input string (5 ops)