Murl Engine Lua Addon API  Version 1.0 beta
Murl.Util

Utility classes, templates and functions.

Following is a short overview of how the print/conversion functions are layered (from low to high level):

1) String System::CLib::PrintToStringArg(const Char* format, void* vaListPtr): This is the lowest-level function that can be used to print any list of variables to a Murl::String. It takes an UTF8 format string, and a pointer to a std::va_list (as void*) that carries the variables. Internally, it uses the vsnprintf function for printing, which accepts the standard format specifiers.

2) String System::CLib::PrintToString(const Char* format, ...); For convenience, this function can be used to print to a string without having to build a va_list. This function builds a va_list internally and calls System::CLib::PrintToStringArg().

3) String Util::PrintToString(const Char* format, ...) This function is pretty much identical to 2), provided as a convenience in the Util namespace.

4) String Util::UInt64ToString(UInt64 inputValue, const String& format) This function (and the respective functions for the other data types described below) directly calls Util::PrintToString() with the given format and the inputValue as a single value parameter. Care must be taken that the given format is acceptable for the given data type, e.g. providing a format string of "%f" with a Murl::UInt32 variable will produce incorrect results. No check or conversion is done internally to ensure correct behavior.

5) String Util::UInt64ToString(UInt64 inputValue) This function (and the respective functions for the other data types described below) directly call Util::PrintToString() with a default format for the respective data type and the inputValue as a single value parameter. See also below for these default format strings. Calling these methods is preferable when the actual input variable has a different data type than the one desired in the output string, e.g. when a Murl::Float variable should be implicit converted to a Murl::SInt64 variable upon conversion.

6) String Util::ValueToString(UInt64 inputValue) This inline function and the respective overloads for the other data types directly call Util::UInt64ToString() and the respective counterparts. Using these methods is preferable when the input variable of a given data type should be printed with the actual default format for that data type.

Following is a list of number data types and their default format strings used in 5) and 6):

  • Murl::UInt64 : "%llu"
  • Murl::SInt64 : "%lld"
  • Murl::UInt32 : "%u"
  • Murl::SInt32 : "%d"
  • Murl::Double : "%f"


Table members

Classes


Murl.Util.Base64Decoder
Murl.Util.Base64Encoder
Murl.Util.Base64State
Murl.Util.CRC32Checksum
Murl.Util.FileTools
Murl.Util.GeoLocation
Murl.Util.MD5Checksum
Murl.Util.Marsaglia
Murl.Util.Rng
Murl.Util.Rsa
Murl.Util.TT800
Murl.Util.Well1024

Enumerations


MatchOptions

Functions


Murl.Util.StaticEmptyData()

Get a constant static empty data object.

Murl.Data StaticEmptyData()

Returns
Murl.Data The constant static empty data object.

Murl.Util.SwapBytes(value)

Swap all bytes of a 64 bit value.

Integer SwapBytes(Integer value)

Parameters
valueThe value to swap the bytes.
Returns
Integer The value in reverse byte ordering.

Murl.Util.IsDebugBuild()

Check if the engine was built using the debug configuration.

Boolean IsDebugBuild()

Returns
Boolean true if the engine was built using the debug configuration.

Murl.Util.IsReleaseBuild()

Check if the engine was built using the release configuration.

Boolean IsReleaseBuild()

Returns
Boolean true if the engine was built using the release configuration.

Murl.Util.IsDevBuild()

Boolean IsDevBuild()

Returns
Boolean

Murl.Util.Compress(uncompressedIn, compressedOut)

Compress a given data object using ZLib with IEnums::COMPRESSION_LEVEL_DEFAULT.

Boolean, Murl.Data Compress(Murl.ConstData uncompressedIn, Murl.Data compressedOut)

Parameters
uncompressedInThe source data object to compress.
compressedOutA reference to an empty Data object to receive the compressed data.
Returns
Boolean true if successful.
Murl.Data compressedOut A reference to an empty Data object to receive the compressed data.

Murl.Util.Compress(uncompressedIn, compressedOut, compressionLevel)

Compress a given data object using ZLib with a specified compression level.

Boolean, Murl.Data Compress(Murl.ConstData uncompressedIn, Murl.Data compressedOut, Murl.IEnums.CompressionLevel compressionLevel)

Parameters
uncompressedInThe source data object to compress.
compressedOutA reference to an empty Data object to receive the compressed data.
compressionLevelThe compression level.
Returns
Boolean true if successful.
Murl.Data compressedOut A reference to an empty Data object to receive the compressed data.

Murl.Util.Uncompress(compressedIn, uncompressedOut)

Uncompress a given data object using ZLib.

Boolean, Murl.Data Uncompress(Murl.ConstData compressedIn, Murl.Data uncompressedOut)

Parameters
compressedInThe source data object to decompress.
uncompressedOutA reference to an empty Data object to receive the uncompressed data.
Returns
Boolean true if successful.
Murl.Data uncompressedOut A reference to an empty Data object to receive the uncompressed data.

Murl.Util.EncodeBase64(dataIn)

Encode a string to a Base64 character string.

String EncodeBase64(String dataIn)

Parameters
dataInThe source string to encode.
Returns
String The Base64 character encoded string.

Murl.Util.EncodeBase64(dataIn)

Encode a data object to a Base64 character string.

String EncodeBase64(Murl.ConstData dataIn)

Parameters
dataInThe source data object to encode.
Returns
String The Base64 character encoded string.

Murl.Util.DecodeBase64(dataIn)

Decode a Base64 character string.

Murl.Data DecodeBase64(String dataIn)

Parameters
dataInThe source Base64 character string to decode.
Returns
Murl.Data The decoded data object.

Murl.Util.DecodeBase64(dataIn)

Decode Base64 characters from a data object.

Murl.Data DecodeBase64(Murl.ConstData dataIn)

Parameters
dataInThe source data object to decode.
Returns
Murl.Data The decoded data object.

Murl.Util.IsBase64(dataIn)

Check if a string is Base64 encoded.

Boolean IsBase64(String dataIn)

Parameters
dataInThe source Base64 string.
Returns
Boolean true if the string is Base64 encoded.

Murl.Util.IsBase64(dataIn)

Check if a data object is Base64 encoded.

Boolean IsBase64(Murl.ConstData dataIn)

Parameters
dataInThe source Base64 data object.
Returns
Boolean true if the data object is Base64 encoded.

Murl.Util.EncodeHex(dataIn)

Encode a string to a Hex character string.

String EncodeHex(String dataIn)

Parameters
dataInThe source string to encode.
Returns
String The Hex character encoded string.

Murl.Util.EncodeHex(dataIn)

Encode a data object to a Hex character string

String EncodeHex(Murl.ConstData dataIn)

Parameters
dataInThe source data object to encode.
Returns
String The Hex character encoded string.

Murl.Util.DecodeHex(dataIn)

Decode a Hex character string.

Murl.Data DecodeHex(String dataIn)

Parameters
dataInThe source Hex character string to decode.
Returns
Murl.Data The decoded data object.

Murl.Util.DecodeHex(dataIn)

Decode Hex characters from a data object.

Murl.Data DecodeHex(Murl.ConstData dataIn)

Parameters
dataInThe source data object to decode.
Returns
Murl.Data The decoded data object.

Murl.Util.EncodeUrl(source)

Encode a string to a url character string (percentage encoding).

String EncodeUrl(String source)

Parameters
sourceThe source string to encode.
Returns
String The url character encoded string.

Murl.Util.DecodeUrl(source)

Decode a url character string (percentage encoding) to a string.

String DecodeUrl(String source)

Parameters
sourceThe source url character string to decode.
Returns
String The decoded string.

Murl.Util.EncodeXml(source)

Encode a string so that it can be used as an XML attribute value.

String EncodeXml(String source)

Parameters
sourceThe source string to encode.
Returns
String The XML encoded string.

Murl.Util.SortUInt64Array(array, ascending)

Sort a UInt64 array. The array is sorted by using the quick sort algorithm.

Murl.Array.UInt64 SortUInt64Array(Murl.Array.UInt64 array, Boolean ascending)

Parameters
arrayThe array to sort.
ascendingtrue for ascending sort order, false for descending sort order.
Returns
Murl.Array.UInt64 array The array to sort.

Murl.Util.SortSInt64Array(array, ascending)

Sort a SInt64 array. The array is sorted by using the quick sort algorithm.

Murl.Array.SInt64 SortSInt64Array(Murl.Array.SInt64 array, Boolean ascending)

Parameters
arrayThe array to sort.
ascendingtrue for ascending sort order, false for descending sort order.
Returns
Murl.Array.SInt64 array The array to sort.

Murl.Util.SortUInt32Array(array, ascending)

Sort a UInt32 array. The array is sorted by using the quick sort algorithm.

Murl.Array.UInt32 SortUInt32Array(Murl.Array.UInt32 array, Boolean ascending)

Parameters
arrayThe array to sort.
ascendingtrue for ascending sort order, false for descending sort order.
Returns
Murl.Array.UInt32 array The array to sort.

Murl.Util.SortSInt32Array(array, ascending)

Sort a SInt32 array. The array is sorted by using the quick sort algorithm.

Murl.Array.SInt32 SortSInt32Array(Murl.Array.SInt32 array, Boolean ascending)

Parameters
arrayThe array to sort.
ascendingtrue for ascending sort order, false for descending sort order.
Returns
Murl.Array.SInt32 array The array to sort.

Murl.Util.SortRealArray(array, ascending)

Sort a Real array. The array is sorted by using the quick sort algorithm.

Murl.Array.Real SortRealArray(Murl.Array.Real array, Boolean ascending)

Parameters
arrayThe array to sort.
ascendingtrue for ascending sort order, false for descending sort order.
Returns
Murl.Array.Real array The array to sort.

Murl.Util.SortDoubleArray(array, ascending)

Sort a Double array. The array is sorted by using the quick sort algorithm.

Murl.Array.Double SortDoubleArray(Murl.Array.Double array, Boolean ascending)

Parameters
arrayThe array to sort.
ascendingtrue for ascending sort order, false for descending sort order.
Returns
Murl.Array.Double array The array to sort.

Murl.Util.SortStringArray(array, ascending)

Sort a String array. The array is sorted by using the quick sort algorithm.

Murl.Array.String SortStringArray(Murl.Array.String array, Boolean ascending)

Parameters
arrayThe array to sort.
ascendingtrue for ascending sort order, false for descending sort order.
Returns
Murl.Array.String array The array to sort.

Murl.Util.StaticEmptyString()

Get the reference to a static empty string.

String StaticEmptyString()

Returns
String The reference to a static empty string.

Murl.Util.StaticWhitespaceString()

Get the reference to a static whitespace string. The whitespace string contains the characters:

" \t\r\n"

String StaticWhitespaceString()

Returns
String The reference to a static whitespace string.

Murl.Util.StaticEmptyStringArray()

Get the reference to a static empty string array.

Murl.Array.String StaticEmptyStringArray()

Returns
Murl.Array.String The reference to a static empty string array.

Murl.Util.SplitString(inputString, delimiter, pieces, acceptEmpty)

Split a string into pieces using a given delimiter, the pieces are stored in a string array.

Integer, Murl.Array.String SplitString(String inputString, Char delimiter, Murl.Array.String pieces, Boolean acceptEmpty)

Parameters
inputStringThe string to split.
delimiterThe delimiter character.
piecesThe pieces return value.
acceptEmptyIf true, also empty pieces are accepted, i.e. subsequent pieces are considered to be separated by a single delimiter only.
Returns
Integer The number of pieces.
Murl.Array.String pieces The pieces return value.

Murl.Util.SplitString(inputString, delimiter, pieces, acceptEmpty)

Split a string into pieces using a given delimiter, the pieces are stored in a string index.

Integer, Murl.Index.String SplitString(String inputString, Char delimiter, Murl.Index.String pieces, Boolean acceptEmpty)

Parameters
inputStringThe string to split.
delimiterThe delimiter character.
piecesThe pieces return value.
acceptEmptyIf true, also empty pieces are accepted, i.e. subsequent pieces are considered to be separated by a single delimiter only.
Returns
Integer The number of pieces.
Murl.Index.String pieces The pieces return value.

Murl.Util.SplitString(inputString, delimiters, pieces, acceptEmpty)

Split a string into pieces using a given set of delimiters, the pieces are stored in a string array.

Integer, Murl.Array.String SplitString(String inputString, String delimiters, Murl.Array.String pieces, Boolean acceptEmpty)

Parameters
inputStringThe string to split.
delimitersA string containing all delimiter characters.
piecesThe pieces return value.
acceptEmptyIf true, also empty pieces are accepted, i.e. subsequent pieces are considered to be separated by a single delimiter only.
Returns
Integer The number of pieces.
Murl.Array.String pieces The pieces return value.

Murl.Util.SplitString(inputString, delimiters, pieces, acceptEmpty)

Split a string into pieces using a given set of delimiters, the pieces are stored in a string index.

Integer, Murl.Index.String SplitString(String inputString, String delimiters, Murl.Index.String pieces, Boolean acceptEmpty)

Parameters
inputStringThe string to split.
delimitersA string containing all delimiter characters.
piecesThe pieces return value.
acceptEmptyIf true, also empty pieces are accepted, i.e. subsequent pieces are considered to be separated by a single delimiter only.
Returns
Integer The number of pieces.
Murl.Index.String pieces The pieces return value.

Murl.Util.JoinStringArray(inputStrings, separator, joinEmpty)

Join all strings from a string array.

String JoinStringArray(Murl.Array.String inputStrings, String separator, Boolean joinEmpty)

Parameters
inputStringsThe string array to join.
separatorThe separator string to separate the input strings.
joinEmptyIf true, also empty strings are added from the input strings.
Returns
String The joined string.

Murl.Util.JoinStringIndex(inputStrings, separator, joinEmpty)

Join all strings from a string index.

String JoinStringIndex(Murl.Index.String inputStrings, String separator, Boolean joinEmpty)

Parameters
inputStringsThe string index to join.
separatorThe separator string to separate the input strings.
joinEmptyIf true, also empty strings are added from the input strings.
Returns
String The joined string.

Murl.Util.IndentString(inputString, indent, indentEmpty)

Indent a (multi-line) string by a given number of white spaces.

String IndentString(String inputString, Integer indent, Boolean indentEmpty)

Parameters
inputStringThe string to indent.
indentThe number of spaces to indent. If this is negative, the given number of spaces are removed from the beginning of each line, if present.
indentEmptyIf false, empty lines are not processed (default).
Returns
String The processed string.

Murl.Util.FillInParameters(inputString, parameters)

Fill in a set of given parameters into a placeholder string. A placeholder is represented by a zero-based integer within curly braces, e.g. "{0}", "{7}" or "{42}" (without quotes). The integer represents the index into the given parameters array.

String FillInParameters(String inputString, Murl.Array.String parameters)

Parameters
inputStringThe placeholder string.
parametersAn array of string holding the individual parameters.
Returns
String The processed string.

Murl.Util.TrimStringArray(inputString)

Trim all strings in a string array. Trim white spaces from left and right for each string in the array.

Murl.Array.String TrimStringArray(Murl.Array.String inputString)

Parameters
inputStringThe string array to trim.
Returns
Murl.Array.String inputString The string array to trim.

Murl.Util.GetLine(inputString, startPos)

Get a line from a string.

String, Integer GetLine(String inputString, Integer startPos)

Parameters
inputStringThe string to get the line from.
startPosThe start position to get the line from. The start position is set to the beginning of the next line or to -1 if the end of the input string is reached.
Returns
String The line string.
Integer startPos The start position to get the line from. The start position is set to the beginning of the next line or to -1 if the end of the input string is reached.

Murl.Util.GetWord(inputString, startPos)

Get the next word from a string.

String, Integer GetWord(String inputString, Integer startPos)

Parameters
inputStringThe string to get the word from.
startPosThe start position to get the word from. The start position is set to the beginning of the next word or to -1 if the end of the input string is reached.
Returns
String The word string.
Integer startPos The start position to get the word from. The start position is set to the beginning of the next word or to -1 if the end of the input string is reached.

Murl.Util.HasCppScope(className)

Check if a class name has a "::" part.

Boolean HasCppScope(String className)

Parameters
classNameThe class name string.
Returns
Boolean true if the class name contains a "::" part.

Murl.Util.GetCppScope(className)

Get the class name substring before the "::" part.

String GetCppScope(String className)

Parameters
classNameThe class name string.
Returns
String The class name substring before the "::" part. If the "::" part is not found an empty string is returned.

Murl.Util.StripCppScope(className)

Get the class name substring behind the "::" part.

String StripCppScope(String className)

Parameters
classNameThe class name string.
Returns
String The class name substring behind the "::" part. If the "::" part is not found an empty string is returned.

Murl.Util.HasScope(name)

Check if a name has a dot character.

Boolean HasScope(String name)

Parameters
nameThe name string.
Returns
Boolean true if the name contains a '.' character.

Murl.Util.GetScope(name)

Get the substring before the dot character.

String GetScope(String name)

Parameters
nameThe name string.
Returns
String The name substring before the '.' character. If the '.' character is not found an empty string is returned.

Murl.Util.StripScope(name)

Get the substring behind the dot character.

String StripScope(String name)

Parameters
nameThe name string.
Returns
String The name substring behind the '.' character. If the '.' character is not found an empty string is returned.

Murl.Util.StripIndex(name, index, trimOutput)

Strip the index part from a name and get the index value. For example, the input string "param[7]" will be split so that the "name" variable contains the string "param", and index is set to 7.

Boolean, String, Integer StripIndex(String name, Integer index, Boolean trimOutput)

Parameters
nameThe name string to strip.
indexThe index return value.
trimOutputIf true, leading and trailing whitespaces are removed from the name after stripping.
Returns
Boolean true if successful.
String name The name string to strip.
Integer index The index return value.

Murl.Util.StripCount(name, count, trimOutput)

Strip the count part from a name and get its value. For example, the input string "param7" will be split so that the "name" variable contains the string "param", and count is set to 7.

Boolean, String, Integer StripCount(String name, Integer count, Boolean trimOutput)

Parameters
nameThe name string to strip.
countThe count return value.
trimOutputIf true, leading and trailing whitespaces are removed from the name after stripping.
Returns
Boolean true if successful.
String name The name string to strip.
Integer count The count return value.

Murl.Util.IsIdValid(identifier)

Check if an identifier string is valid. A valid identifier contains:

  • Alphanumeric characters and '.', '_', '{', '}'.
  • No leading numeric characters.

Boolean IsIdValid(String identifier)

Parameters
identifierThe identifier string to check.
Returns
Boolean true if the identifier string is valid.

Murl.Util.IsNumeric(str)

Check if a string has numeric characters only. A leading '+' or '-' character is allowed.

Boolean IsNumeric(String str)

Parameters
strThe string to check.
Returns
Boolean true if the string has numeric characters only.

Murl.Util.IsAlphaNumeric(chr)

Check if a character is an alphanumeric character.

Boolean IsAlphaNumeric(Char chr)

Parameters
chrThe character to check.
Returns
Boolean true if the character is an alphanumeric character.

Murl.Util.IsAlphaNumeric(str)

Check if a string has alphanumeric characters only.

Boolean IsAlphaNumeric(String str)

Parameters
strThe string to check.
Returns
Boolean true if the string has alphanumeric characters only.

Murl.Util.IsDigit(chr)

Check if a character is a digit character.

Boolean IsDigit(Char chr)

Parameters
chrThe character to check.
Returns
Boolean true if the character is a digit character.

Murl.Util.IsAlpha(chr)

Check if a character is an alphabetic character.

Boolean IsAlpha(Char chr)

Parameters
chrThe character to check.
Returns
Boolean true if the character is an alphabetic character.

Murl.Util.IsPunctuation(chr)

Check if a character is a punctuation character.

Boolean IsPunctuation(Char chr)

Parameters
chrThe character to check.
Returns
Boolean true if the character is a punctuation character.

Murl.Util.IsSpace(chr)

Check if a character is a spacing character. A whitespace is a space, form feed '\f', newline '\n', carriage return '\r', vertical tabulator '\v' or horizontal tabulator '\t' character.

Boolean IsSpace(Char chr)

Parameters
chrThe character to check.
Returns
Boolean true if the character is a spacing character.

Murl.Util.IsHexDigit(chr)

Check if a character is a hexadecimal character.

Boolean IsHexDigit(Char chr)

Parameters
chrThe character to check.
Returns
Boolean true if the character is a hexadecimal character.

Murl.Util.IsControl(chr)

Check if a character is a control character.

Boolean IsControl(Char chr)

Parameters
chrThe character to check.
Returns
Boolean true if the character is a control character.

Murl.Util.StringToBool(inputString, value)

Convert a decimal string to a bool value. The conversion ignores case, leading and trailing whitespaces.

  • "true", "on", "yes", "1" or any integer not equal to zero for true.
  • "false", "off", "no" or "0" for false.

Boolean, Boolean StringToBool(String inputString, Boolean value)

Parameters
inputStringThe string to convert.
valueThe return value.
Returns
Boolean true if conversion was successful, if the conversion failed the value parameter is unchanged and false is returned.
Boolean value The return value.

Murl.Util.StringToUInt64(inputString, value)

Convert a decimal string to a UInt64 value. The conversion ignores leading and trailing whitespaces.

Boolean, Integer StringToUInt64(String inputString, Integer value)

Parameters
inputStringThe string to convert.
valueThe return value.
Returns
Boolean true if conversion was successful, if the conversion failed the value parameter is unchanged and false is returned.
Integer value The return value.

Murl.Util.StringToSInt64(inputString, value)

Convert a decimal string to a SInt64 value. The conversion ignores leading and trailing whitespaces.

Boolean, Integer StringToSInt64(String inputString, Integer value)

Parameters
inputStringThe string to convert.
valueThe return value.
Returns
Boolean true if conversion was successful, if the conversion failed the value parameter is unchanged and false is returned.
Integer value The return value.

Murl.Util.StringToUInt32(inputString, value)

Convert a decimal string to a UInt32 value. The conversion ignores leading and trailing whitespaces.

Boolean, Integer StringToUInt32(String inputString, Integer value)

Parameters
inputStringThe string to convert.
valueThe return value.
Returns
Boolean true if conversion was successful, if the conversion failed the value parameter is unchanged and false is returned.
Integer value The return value.

Murl.Util.StringToSInt32(inputString, value)

Convert a decimal string to a SInt32 value. The conversion ignores leading and trailing whitespaces.

Boolean, Integer StringToSInt32(String inputString, Integer value)

Parameters
inputStringThe string to convert.
valueThe return value.
Returns
Boolean true if conversion was successful, if the conversion failed the value parameter is unchanged and false is returned.
Integer value The return value.

Murl.Util.StringToDouble(inputString, value)

Convert a string to a Double value. The conversion ignores leading and trailing whitespaces. The decimal separator is the '.' character (locale independent).

Boolean, Number StringToDouble(String inputString, Number value)

Parameters
inputStringThe string to convert.
valueThe return value.
Returns
Boolean true if conversion was successful, if the conversion failed the value parameter is unchanged and false is returned.
Number value The return value.

Murl.Util.StringToFloat(inputString, value)

Convert a string to a Float value. The conversion ignores leading and trailing whitespaces. The decimal separator is the '.' character (locale independent).

Boolean, Number StringToFloat(String inputString, Number value)

Parameters
inputStringThe string to convert.
valueThe return value.
Returns
Boolean true if conversion was successful, if the conversion failed the value parameter is unchanged and false is returned.
Number value The return value.

Murl.Util.StringToColor(inputString, value)

Convert a string to a color object. See StringToColor(const String& inputString, Color& value, Color::StringFormat& format).

Boolean, Murl.Color StringToColor(String inputString, Murl.Color value)

Parameters
inputStringThe string to convert.
valueThe color return value.
Returns
Boolean true if conversion was successful, if the conversion failed the 'value' return value is unchanged and false is returned.
Murl.Color value The color return value.

Murl.Util.StringToColor(inputString, value, format)

Convert a string to a color object. The conversion ignores case, leading and trailing whitespaces. A color value can be specified by comma separated component values or a single 32 bit hex value:

  • "RR, GG, BB, AA" The alpha value is optional, the default alpha is 1.0.
  • "AARRGGBBh", e.g. "ff7f3f1fh".
  • "RRGGBBh", e.g. "7f3f1fh", alpha is set to 1.0.

The component format specifiers are:

  • f float component range is [0.0 .. 1.0], e.g. "0.5f, 0.25f, 0.125f, 1.0f".
  • i integer component range is [0 .. 255], e.g. "127i, 63i, 31i, 255i".
  • h hex component range is [0x00 .. 0xff], e.g. "7fh, 3fh, 1fh, ffh".

If a component has no format specifier the float format is assumed. If the string has only one component and the format specifier is missing, the "AARRGGBBh" format is assumed.

Boolean, Murl.Color, Murl.ColorStringFormat StringToColor(String inputString, Murl.Color value, Murl.ColorStringFormat format)

Parameters
inputStringThe string to convert.
valueThe color return value.
formatThis return value is set to the color string format recognized during conversion, or Color::STRING_FORMAT_UNKNOWN if failed. If different format specifiers are given, Color::STRING_FORMAT_MIXED is returned, and if not all of the given components have an explicit specifier, Color::STRING_FORMAT_INCOMPLETE is returned.
Returns
Boolean true if conversion was successful. If the conversion failed the 'value' return value is unchanged and false is returned.
Murl.Color value The color return value.
Murl.ColorStringFormat format This return value is set to the color string format recognized during conversion, or Color::STRING_FORMAT_UNKNOWN if failed. If different format specifiers are given, Color::STRING_FORMAT_MIXED is returned, and if not all of the given components have an explicit specifier, Color::STRING_FORMAT_INCOMPLETE is returned.

Murl.Util.StringToColor(inputString, value, hasType)

Convert a string to a color object. See StringToColor(const String& inputString, Color& value, Color::StringFormat& format).

Boolean, Murl.Color, Boolean StringToColor(String inputString, Murl.Color value, Boolean hasType)

Parameters
inputStringThe string to convert.
valueThe color return value.
hasTypeThis return value is set to false if any format specifier is missing.
Returns
Boolean true if conversion was successful, if the conversion failed the 'value' return value is unchanged and false is returned.
Murl.Color value The color return value.
Boolean hasType This return value is set to false if any format specifier is missing.

Murl.Util.StringToColorComponent(inputString, value)

Convert a string to a Float color component. See StringToColorComponent(const String& inputString, Float& value, Color::StringFormat& format).

Boolean, Number StringToColorComponent(String inputString, Number value)

Parameters
inputStringThe string to convert.
valueThe color component return value.
Returns
Boolean true if conversion was successful, if the conversion failed the 'value' return value is unchanged and false is returned.
Number value The color component return value.

Murl.Util.StringToColorComponent(inputString, value, format)

Convert a string to a Float color component. The conversion ignores case, leading and trailing whitespaces. The component format specifiers are:

  • f float component range is [0.0 .. 1.0], e.g. "0.5f".
  • i integer component range is [0 .. 255], e.g. "127i".
  • h hex component range is [0x00 .. 0xff], e.g. "7fh".

If the format specifier is missing the float format is assumed.

Boolean, Number, Murl.ColorStringFormat StringToColorComponent(String inputString, Number value, Murl.ColorStringFormat format)

Parameters
inputStringThe string to convert.
valueThe color component return value.
formatThis return value is set to the color string format recognized during conversion, or Color::STRING_FORMAT_UNKNOWN if failed. If different format specifiers are given, Color::STRING_FORMAT_MIXED is returned, and if not all of the given components have an explicit specifier, Color::STRING_FORMAT_INCOMPLETE is returned.
Returns
Boolean true if conversion was successful, if the conversion failed the 'value' return value is unchanged and false is returned.
Number value The color component return value.
Murl.ColorStringFormat format This return value is set to the color string format recognized during conversion, or Color::STRING_FORMAT_UNKNOWN if failed. If different format specifiers are given, Color::STRING_FORMAT_MIXED is returned, and if not all of the given components have an explicit specifier, Color::STRING_FORMAT_INCOMPLETE is returned.

Murl.Util.StringToColorComponent(inputString, value, hasType)

Convert a string to a Float color component. See StringToColorComponent(const String& inputString, Float& value, Color::StringFormat& format).

Boolean, Number, Boolean StringToColorComponent(String inputString, Number value, Boolean hasType)

Parameters
inputStringThe string to convert.
valueThe color component return value.
hasTypeThis return value is set to false if any format specifier is missing.
Returns
Boolean true if conversion was successful, if the conversion failed the 'value' return value is unchanged and false is returned.
Number value The color component return value.
Boolean hasType This return value is set to false if any format specifier is missing.

Murl.Util.HexStringToUInt64(inputString, value)

Convert a hexadecimal string to a UInt64 value. The conversion ignores leading and trailing whitespaces.

Boolean, Integer HexStringToUInt64(String inputString, Integer value)

Parameters
inputStringThe string to convert.
valueThe return value.
Returns
Boolean true if conversion was successful, if the conversion failed the value parameter is unchanged and false is returned.
Integer value The return value.

Murl.Util.HexStringToUInt32(inputString, value)

Convert a hexadecimal string to a UInt32 value. The conversion ignores leading and trailing whitespaces.

Boolean, Integer HexStringToUInt32(String inputString, Integer value)

Parameters
inputStringThe string to convert.
valueThe return value.
Returns
Boolean true if conversion was successful, if the conversion failed the value parameter is unchanged and false is returned.
Integer value The return value.

Murl.Util.AngleStringToDouble(inputString, value, hasUnit)

Convert an angle string to a Double value. The conversion ignores case, leading and trailing whitespaces. An angle string can specify the unit:

  • deg or d for degress, e.g. "180 deg"
  • rad or r for radiants, e.g. "3.1415 rad"

If the unit specifier is missing the radiants unit is assumed.

Boolean, Number, Boolean AngleStringToDouble(String inputString, Number value, Boolean hasUnit)

Parameters
inputStringThe string to convert.
valueThe angle return value.
hasUnitThis return value is set to false if the unit specifier is missing.
Returns
Boolean true if conversion was successful, if the conversion failed the 'value' return value is unchanged and false is returned.
Number value The angle return value.
Boolean hasUnit This return value is set to false if the unit specifier is missing.

Murl.Util.StringToBoolArray(inputString, delimiter, values)

Convert a string to a Bool array using a given delimiter.

Boolean, Murl.Array.Bool StringToBoolArray(String inputString, Char delimiter, Murl.Array.Bool values)

Parameters
inputStringThe string to convert.
delimiterThe delimiter character.
valuesThe return values array.
Returns
Boolean true if successful, false if converting the values failed.
Murl.Array.Bool values The return values array.

Murl.Util.StringToUInt64Array(inputString, delimiter, values)

Convert a string to a UInt64 array using a given delimiter.

Boolean, Murl.Array.UInt64 StringToUInt64Array(String inputString, Char delimiter, Murl.Array.UInt64 values)

Parameters
inputStringThe string to convert.
delimiterThe delimiter character.
valuesThe return values array.
Returns
Boolean true if successful, false if converting the values failed.
Murl.Array.UInt64 values The return values array.

Murl.Util.StringToSInt64Array(inputString, delimiter, values)

Convert a string to a SInt64 array using a given delimiter.

Boolean, Murl.Array.SInt64 StringToSInt64Array(String inputString, Char delimiter, Murl.Array.SInt64 values)

Parameters
inputStringThe string to convert.
delimiterThe delimiter character.
valuesThe return values array.
Returns
Boolean true if successful, false if converting the values failed.
Murl.Array.SInt64 values The return values array.

Murl.Util.StringToUInt32Array(inputString, delimiter, values)

Convert a string to a UInt32 array using a given delimiter.

Boolean, Murl.Array.UInt32 StringToUInt32Array(String inputString, Char delimiter, Murl.Array.UInt32 values)

Parameters
inputStringThe string to convert.
delimiterThe delimiter character.
valuesThe return values array.
Returns
Boolean true if successful, false if converting the values failed.
Murl.Array.UInt32 values The return values array.

Murl.Util.StringToSInt32Array(inputString, delimiter, values)

Convert a string to a SInt32 array using a given delimiter.

Boolean, Murl.Array.SInt32 StringToSInt32Array(String inputString, Char delimiter, Murl.Array.SInt32 values)

Parameters
inputStringThe string to convert.
delimiterThe delimiter character.
valuesThe return values array.
Returns
Boolean true if successful, false if converting the values failed.
Murl.Array.SInt32 values The return values array.

Murl.Util.StringToDoubleArray(inputString, delimiter, values)

Convert a string to a Double array using a given delimiter.

Boolean, Murl.Array.Double StringToDoubleArray(String inputString, Char delimiter, Murl.Array.Double values)

Parameters
inputStringThe string to convert.
delimiterThe delimiter character.
valuesThe return values array.
Returns
Boolean true if successful, false if converting the values failed.
Murl.Array.Double values The return values array.

Murl.Util.StringToFloatArray(inputString, delimiter, values)

Convert a string to a Float array using a given delimiter.

Boolean, Murl.Array.Float StringToFloatArray(String inputString, Char delimiter, Murl.Array.Float values)

Parameters
inputStringThe string to convert.
delimiterThe delimiter character.
valuesThe return values array.
Returns
Boolean true if successful, false if converting the values failed.
Murl.Array.Float values The return values array.

Murl.Util.UInt64ToString(inputValue)

Convert a UInt64 value to a string.

String UInt64ToString(Integer inputValue)

Parameters
inputValueThe value to convert.
Returns
String The converted string.

Murl.Util.UInt64ToString(inputValue, format)

Convert a UInt64 value to a string using a format string.

String UInt64ToString(Integer inputValue, String format)

Parameters
inputValueThe value to convert.
formatThe format string should contain "%llu".
Returns
String The converted string.

Murl.Util.SInt64ToString(inputValue)

Convert a SInt64 value to a string.

String SInt64ToString(Integer inputValue)

Parameters
inputValueThe value to convert.
Returns
String The converted string.

Murl.Util.SInt64ToString(inputValue, format)

Convert a SInt64 value to a string using a format string.

String SInt64ToString(Integer inputValue, String format)

Parameters
inputValueThe value to convert.
formatThe format string should contain "%lld".
Returns
String The converted string.

Murl.Util.UInt32ToString(inputValue)

Convert a UInt32 value to a string.

String UInt32ToString(Integer inputValue)

Parameters
inputValueThe value to convert.
Returns
String The converted string.

Murl.Util.UInt32ToString(inputValue, format)

Convert a UInt32 value to a string using a format string.

String UInt32ToString(Integer inputValue, String format)

Parameters
inputValueThe value to convert.
formatThe format string should contain "%u".
Returns
String The converted string.

Murl.Util.SInt32ToString(inputValue)

Convert a SInt32 value to a string.

String SInt32ToString(Integer inputValue)

Parameters
inputValueThe value to convert.
Returns
String The converted string.

Murl.Util.SInt32ToString(inputValue, format)

Convert a SInt32 value to a string using a format string.

String SInt32ToString(Integer inputValue, String format)

Parameters
inputValueThe value to convert.
formatThe format string should contain "%d".
Returns
String The converted string.

Murl.Util.DoubleToString(inputValue)

Convert a Double value to a string.

String DoubleToString(Number inputValue)

Parameters
inputValueThe value to convert.
Returns
String The converted string.

Murl.Util.DoubleToString(inputValue, format)

Convert a Double value to a string using a format string.

String DoubleToString(Number inputValue, String format)

Parameters
inputValueThe value to convert.
formatThe format string should contain "%f" or "%g".
Returns
String The converted string.

Murl.Util.ColorToString(inputValue)

Convert a Color object to a string in float representation.

String ColorToString(Murl.Color inputValue)

Parameters
inputValueThe color to convert.
Returns
String The converted string.

Murl.Util.ColorToString(inputValue, colorStringFormat)

Convert a Color object to a string using a given color string format.

String ColorToString(Murl.Color inputValue, Murl.ColorStringFormat colorStringFormat)

Parameters
inputValueThe color to convert.
colorStringFormatThe color string format.
Returns
String The converted string.

Murl.Util.ColorToString(inputValue, colorStringFormat, format)

Convert a Color object to a string using a given color string format.

String ColorToString(Murl.Color inputValue, Murl.ColorStringFormat colorStringFormat, String format)

Parameters
inputValueThe color to convert.
colorStringFormatThe color string format
formatThe format string should contain "%f" or "%g" for Color::STRING_FORMAT_FLOAT, "%i" or "%x" (or similar) for int and hex formats.
Returns
String The converted string.

Murl.Util.ColorToString(inputValue, format)

Convert a Color object to a string in float representation.

String ColorToString(Murl.Color inputValue, String format)

Parameters
inputValueThe color to convert.
formatThe format string should contain "%f" or "%g".
Returns
String The converted string.

Murl.Util.BoolToString(inputValue)

Convert a Bool value to a string.

String BoolToString(Boolean inputValue)

Parameters
inputValueThe value to convert.
Returns
String The converted string "true" or "false".

Murl.Util.TimeToString(inputValue)

Convert a time value to a string.

String TimeToString(Murl.System.Time inputValue)

Parameters
inputValueThe value to convert.
Returns
String The converted string "h:mm:ss".

Murl.Util.TimeToString(inputValue, separator)

Convert a time value to a string using a separator.

String TimeToString(Murl.System.Time inputValue, String separator)

Parameters
inputValueThe value to convert.
separatorThe separator string.
Returns
String The converted string "h[separator]mm[separator]ss".

Murl.Util.Utf8ToUtf32(inputBytes, outputValue, numToSkip)

Convert an UTF8 character sequence to an UTF32 character. For string operation the String class provides the GetUTF32Chars() method.

Boolean, Integer, Integer Utf8ToUtf32(String inputBytes, Integer outputValue, Integer numToSkip)

Parameters
inputBytesPointer to the UTF8 character(s).
outputValueThe UTF-32 character return value.
numToSkipReturn value parameter returning the number of input bytes to skip to the next UTF8 character.
Returns
Boolean true if successful.
Integer outputValue The UTF-32 character return value.
Integer numToSkip Return value parameter returning the number of input bytes to skip to the next UTF8 character.

Murl.Util.ValueToString(inputValue)

ValueToString overload for DoubleToString() method.

String ValueToString(Number inputValue)

Parameters
inputValueThe value to convert.
Returns
String The converted string.

Murl.Util.ValueToString(inputValue)

ValueToString overload for BoolToString() method.

String ValueToString(Boolean inputValue)

Parameters
inputValueThe value to convert.
Returns
String The converted string.

Murl.Util.ValueToString(inputValue)

ValueToString overload for ColorToString() method.

String ValueToString(Murl.Color inputValue)

Parameters
inputValueThe value to convert.
Returns
String The converted string.

Murl.Util.ValueToString(inputValue)

ValueToString overload for TimeToString() method.

String ValueToString(Murl.System.Time inputValue)

Parameters
inputValueThe value to convert.
Returns
String The converted string.

Murl.Util.GetFilePath(filePathAndName)

Get the file path substring of a file path and name. Returns the substring before the last '/' character.

String GetFilePath(String filePathAndName)

Parameters
filePathAndNameThe file path and name.
Returns
String The file path substring of the file name. If the '/' character is not found an empty string is returned.

Murl.Util.GetFileName(filePathAndName)

Get the file name substring of a file path and name. Returns the substring behind the last '/' character.

String GetFileName(String filePathAndName)

Parameters
filePathAndNameThe file path and name.
Returns
String The file name substring of the file name. If the '/' character is not found the input string is returned.

Murl.Util.GetFileExtension(fileName)

Get the file extension substring of a file name. Returns the substring behind the last '.' character.

String GetFileExtension(String fileName)

Parameters
fileNameThe file name.
Returns
String The file extension substring of the file name. If the '.' character is not found an empty string is returned.

Murl.Util.StripExtension(fileName)

Strip the file extension from a file name. Returns the substring before the last '.' character.

String StripExtension(String fileName)

Parameters
fileNameThe file name.
Returns
String The file name substring excluding the file extension. If the '.' character is not found the input string is returned.

Murl.Util.StripPathAndExtension(filePathAndName)

Strip the file path and extension from a file path and name. Returns the substring from the last '/' to the last '.' character.

String StripPathAndExtension(String filePathAndName)

Parameters
filePathAndNameThe file path and name.
Returns
String The file name substring excluding the file path and extension. If the '.' and '/' character is not found the input string is returned.

Murl.Util.JoinPaths(leftPath, rightPath)

Join two path strings. Ensures exactly one '/' character between the left and the right part.

String JoinPaths(String leftPath, String rightPath)

Parameters
leftPathThe left path string.
rightPathThe right path string.
Returns
String The left plus the right path string.

Murl.Util.GetUnixPath(windowsPath)

Exchange all '\' with '/' characters.

String GetUnixPath(String windowsPath)

Parameters
windowsPathThe path string to convert.
Returns
String The Unix path string.

Murl.Util.GetWindowsPath(unixPath)

Exchange all '/' with '\' characters.

String GetWindowsPath(String unixPath)

Parameters
unixPathThe path string to convert.
Returns
String The Windows path string.

Murl.Util.GetNormalizedPath(path)

Get a normalized path. Returns the given path, with all occurrences of "." removed, and any occurrences of ".." recursively joined with the previous sub-path.

String GetNormalizedPath(String path)

Parameters
pathThe path to normalize.
Returns
String The normalized Unix-style path.

Murl.Util.GetRelativePath(absolutePath, absoluteBasePath)

Get a relative path from an absolute one. When the relative path cannot be resolved, the given absolute path is returned. This may happen e.g. when both given paths are located on different volumes.

String GetRelativePath(String absolutePath, String absoluteBasePath)

Parameters
absolutePathThe absolute path to convert.
absoluteBasePathThe absolute base path relative to which the path is converted.
Returns
String The relative path if it can be resolved, or absolutePath if not.

Murl.Util.GetAbsolutePath(relativePath, absoluteBasePath)

Get an absolute path from a relative one. When the given relative path is actually representing an absolute location (i.e. starting with "/"), it is directly returned. Otherwise, the base path and relative path are concatenated and normalized.

String GetAbsolutePath(String relativePath, String absoluteBasePath)

Parameters
relativePathThe relative path to convert.
absoluteBasePathThe absolute base path relative to which the path is converted.
Returns
String The absolute path if it can be resolved, or relativePath if not.

Murl.Util.HasMatchPattern(name, matchOption)

Check if a name contains pattern matching statements. Pattern matching is supported by IsNameMatching().

Boolean HasMatchPattern(String name, Integer matchOption)

Parameters
nameThe name string to check.
matchOptionThe option for checking, either MATCH_DEFAULT or MATCH_NOESCAPE.
Returns
Boolean true if the name contains pattern matching statements, otherwise false.

Murl.Util.IsNameMatching(pattern, name, matchOptions)

Check if a name matches a specified pattern. Matches patterns according to the Unix-like globbing rules * ? [0-z]. See HasMatchPattern() to check a name for patterns.

Boolean IsNameMatching(String pattern, String name, Integer matchOptions)

Parameters
patternThe pattern string.
nameThe name string to check.
matchOptionsThe options for checking, any MatchOptions can be combined using bitwise OR.
Returns
Boolean true if the name matches the pattern, otherwise false.