wiki.sine.space | sinespace

Difference between revisions of "Scripting/SString"

From wiki.sine.space
Jump to: navigation, search
Line 3: Line 3:
 
==Members==
 
==Members==
 
{{ScriptFunction|string|MD5|(string input);|Calculates the MD5Sum of input and returns the result as a hexadecimal string|Space.String.MD5("An input string with data to hash.")}}
 
{{ScriptFunction|string|MD5|(string input);|Calculates the MD5Sum of input and returns the result as a hexadecimal string|Space.String.MD5("An input string with data to hash.")}}
{{ScriptFunction|string|Base64Encode|(string input);|Converts input to Base64 and returns the result|Space.String.Base64Encode("An input string to encode.")}}
+
{{ScriptFunction|string|Base64Encode|(string input);|Converts input to Base64 and returns the result|5 = local inputString = "input to encode"<br>local baseEncodeStr = Space.String.Base64Encode(inputString)<br>Space.Log(baseEncodeStr)<br>-- prints "aW5wdXQgdG8gZW5jb2Rl"}}
{{ScriptFunction|string|Base64Encode|(byte[] input);|Converts input to Base64 and returns the result}}
+
{{ScriptFunction|string|Base64Encode|(byte[] input);|Converts input to Base64 and returns the result|5 = local inputByteArray = {105, 110, 112, 117, 116, 32, 116, 111, 32, 101, 110, 99, 111, 100, 101}<br>local baseEncodeByte = Space.String.Base64Encode(inputByteArray)<br>Space.Log(baseEncodeByte)<br>-- prints "aW5wdXQgdG8gZW5jb2Rl"}}
 
{{ScriptFunction|string|Base64Decode|(string input);|Converts input from Base64 and returns the result}}
 
{{ScriptFunction|string|Base64Decode|(string input);|Converts input from Base64 and returns the result}}
 
{{ScriptFunction|byte|GetBytes[]|(string input);|Converts input to bytes using UTF8 encoding}}
 
{{ScriptFunction|byte|GetBytes[]|(string input);|Converts input to bytes using UTF8 encoding}}

Revision as of 23:17, 16 February 2017

The SHost class represents the scripting runtime.

Members

MD5

string MD5 (string input);

Calculates the MD5Sum of input and returns the result as a hexadecimal string

Space.String.MD5("An input string with data to hash.")


Base64Encode

string Base64Encode (string input);

Converts input to Base64 and returns the result

local inputString = "input to encode"
local baseEncodeStr = Space.String.Base64Encode(inputString)
Space.Log(baseEncodeStr)
-- prints "aW5wdXQgdG8gZW5jb2Rl"


Base64Encode

string Base64Encode (byte[] input);

Converts input to Base64 and returns the result

local inputByteArray = {105, 110, 112, 117, 116, 32, 116, 111, 32, 101, 110, 99, 111, 100, 101}
local baseEncodeByte = Space.String.Base64Encode(inputByteArray)
Space.Log(baseEncodeByte)
-- prints "aW5wdXQgdG8gZW5jb2Rl"


Base64Decode

string Base64Decode (string input);

Converts input from Base64 and returns the result

No example provided yet


GetBytes[]

byte GetBytes[] (string input);

Converts input to bytes using UTF8 encoding

No example provided yet


GetString

string GetString (byte[] input);

Converts input to a UTF8 string

No example provided yet