ToStringMx█ OVERVIEW
Contains methods for conversion of matrices to string.
Supports matrices of int/float/bool/string/color/line/label/box/.
- toStringMx(matrix) - converts matrix to a string matrix converting each of its elements to string
- toS(matrix) - converts matrix to a string matrix (using toStringMx()) and outputs as string using str.tostring(matrix)
Conversion of each item to string is made using toS() function from moebius1977/ToS/1 library.
█ GENERAL DESCRIPTION OF FUNCTIONS
All toStringMx(matrix) and toS(matrix) methods have same parameters. The only difference will be in format parameter as explained below.
Parameters:
this (matrix) Matrix to be converted to a string matrix.
format (string) Format string.
nz (string) Placeholder for na items.
format parameter depends on the type:
For matrix format parameter works in the same way as `str.format()` (i.e. you can use same format strings as with `str.format()` with `{0}` as a placeholder for the value) with some shorthand "format" options available:
--- number ---
- "" => "{0}"
- "number" => "{0}"
- "0" => "{0, number, 0 }"
- "0.0" => "{0, number, 0.0 }"
- "0.00" => "{0, number, 0.00 }"
- "0.000" => "{0, number, 0.000 }"
- "0.0000" => "{0, number, 0.0000 }"
- "0.00000" => "{0, number, 0.00000 }"
- "0.000000" => "{0, number, 0.000000 }"
- "0.0000000" => "{0, number, 0.0000000}"
--- date ---
- "date" => "{0, date, dd.MM.YY}"
- "date : time" => "{0, date, dd.MM.YY} : {0, time, HH.mm.ss}"
- "dd.MM" => "{0, date, dd:MM}"
- "dd" => "{0, date, dd}"
- "... ... " in any place is substituted with "{0, date, dd.MM.YY}"
--- time ---
- "time" => "{0, time, HH:mm:ss}"
- "HH:mm" => "{0, time, HH:mm}"
- "mm:ss" => "{0, time, mm:ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "date, time" => "{0, date, dd.MM.YY\}, {0, time, HH.mm.ss}"
- "date,time" => "{0, date, dd.MM.YY\},{0, time, HH.mm.ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "... ... " in any place is substituted with "{0, time, HH.mm.ss}"
For matrix :
format (string) : (string) (Optional) Use `x1` as placeholder for `x1` and so on. E.g. default format is `"(x1, y1) - (x2, y2)"`.
For matrix :
format (string) : (string) (Optional) Use `x1` as placeholder for `x`, `y1 - for `y` and `txt` for label's text. E.g. default format is `(x1, y1): "txt"` if ptint_text is true and `(x1, y1)` if false.
For matrix :
format (string) : (string) (Optional) Use `x1` as placeholder for `x`, `y1 - for `y` etc. E.g. default format is "(x1, y1) - (x2, y2)".
For matrix :
format (string) : (string) (Optional) Options are "HEX" (e.g. "#FFFFFF33") or "RGB" (e.g. "rgb(122,122,122,23)"). Default is "HEX".
█ FULL LIST OF FUNCTIONS AND PARAMETERS
method toStringMx(mx, format, nz)
Returns a string matrix made of original matrix items converted to string with toS().
Namespace types: matrix
Parameters:
mx (matrix)
format (string) : (string) Like in str.format()
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.
method toStringMx(mx, format, nz)
Returns a string matrix made of original matrix items converted to string with toS().
Namespace types: matrix
Parameters:
mx (matrix)
format (string) : (string) Like in str.format() with some shorthand options:
```
--- number ---
- "" => "{0}"
- "number" => "{0}"
- "0" => "{0, number, 0 }"
- "0.0" => "{0, number, 0.0 }"
- "0.00" => "{0, number, 0.00 }"
- "0.000" => "{0, number, 0.000 }"
- "0.0000" => "{0, number, 0.0000 }"
- "0.00000" => "{0, number, 0.00000 }"
- "0.000000" => "{0, number, 0.000000 }"
- "0.0000000" => "{0, number, 0.0000000}"
--- date ---
- "date" => "{0, date, dd.MM.YY}"
- "date : time" => "{0, date, dd.MM.YY} : {0, time, HH.mm.ss}"
- "dd.MM" => "{0, date, dd:MM}"
- "dd" => "{0, date, dd}"
- "... ... " in any place is substituted with "{0, date, dd.MM.YY}"
--- time ---
- "time" => "{0, time, HH:mm:ss}"
- "HH:mm" => "{0, time, HH:mm}"
- "mm:ss" => "{0, time, mm:ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "date, time" => "{0, date, dd.MM.YY\}, {0, time, HH.mm.ss}"
- "date,time" => "{0, date, dd.MM.YY\},{0, time, HH.mm.ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "... ... " in any place is substituted with "{0, time, HH.mm.ss}"
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.
method toStringMx(mx, format, nz)
Returns a string matrix made of original matrix items converted to string with toS().
Namespace types: matrix
Parameters:
mx (matrix)
format (string) : (string) Like in str.format() with some shorthand options:
```
--- number ---
- "" => "{0}"
- "number" => "{0}"
- "0" => "{0, number, 0 }"
- "0.0" => "{0, number, 0.0 }"
- "0.00" => "{0, number, 0.00 }"
- "0.000" => "{0, number, 0.000 }"
- "0.0000" => "{0, number, 0.0000 }"
- "0.00000" => "{0, number, 0.00000 }"
- "0.000000" => "{0, number, 0.000000 }"
- "0.0000000" => "{0, number, 0.0000000}"
--- date ---
- "date" => "{0, date, dd.MM.YY}"
- "date : time" => "{0, date, dd.MM.YY} : {0, time, HH.mm.ss}"
- "dd.MM" => "{0, date, dd:MM}"
- "dd" => "{0, date, dd}"
- "... ... " in any place is substituted with "{0, date, dd.MM.YY}"
--- time ---
- "time" => "{0, time, HH:mm:ss}"
- "HH:mm" => "{0, time, HH:mm}"
- "mm:ss" => "{0, time, mm:ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "date, time" => "{0, date, dd.MM.YY\}, {0, time, HH.mm.ss}"
- "date,time" => "{0, date, dd.MM.YY\},{0, time, HH.mm.ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "... ... " in any place is substituted with "{0, time, HH.mm.ss}"
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.
method toStringMx(mx, format, nz)
Returns a string matrix made of original matrix items converted to string with toS().
Namespace types: matrix
Parameters:
mx (matrix)
format (string) : (string) Like in str.format()
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.
method toStringMx(mx, format, nz)
Returns a string matrix made of original matrix items converted to string with toS().
Namespace types: matrix
Parameters:
mx (matrix)
format (string) : (string) "HEX" (default) or "RGB"
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.
method toStringMx(mx, format, nz)
Returns a string matrix made of original matrix items converted to string with toS().
Namespace types: matrix
Parameters:
mx (matrix)
format (string) : (string) (Optional) Format string. By default "{0}: {1}" if showIDs = true or "{1}" otherwise. (use "{0}" as a placeholder for id and "{1}" for item value)
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.
method toStringMx(mx, format, nz)
Returns a string matrix made of original matrix items converted to string with toS().
Namespace types: matrix
Parameters:
mx (matrix)
format (string) : (string) (Optional) Format string. By default "{0}: {1}" if showIDs = true or "{1}" otherwise. (use "{0}" as a placeholder for id and "{1}" for item value)
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.
method toStringMx(mx, format, nz)
Returns a string matrix made of original matrix items converted to string with toS().
Namespace types: matrix
Parameters:
mx (matrix)
format (string) : (string) (Optional) Format string. By default "{0}: {1}" if showIDs = true or "{1}" otherwise. (use "{0}" as a placeholder for id and "{1}" for item value)
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.
method toS(this, format, nz)
Converts each element of the matrix to string outputs using str.tostring(matrix)
Namespace types: matrix
Parameters:
this (matrix) : (matrix) Matrix to be converted to string
format (string) : (string) Format string as in str.format()
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.export method toS(matrix this, string format = "", string nz = na) => str.tostring(this.toStringMx(format, nz))
method toS(this, format, nz)
Converts each element of the matrix to string outputs using str.tostring(matrix)
Namespace types: matrix
Parameters:
this (matrix) : (matrix) Matrix to be converted to string
format (string) : (string) Like in str.format() with some shorthand options:
```
--- number ---
- "" => "{0}"
- "number" => "{0}"
- "0" => "{0, number, 0 }"
- "0.0" => "{0, number, 0.0 }"
- "0.00" => "{0, number, 0.00 }"
- "0.000" => "{0, number, 0.000 }"
- "0.0000" => "{0, number, 0.0000 }"
- "0.00000" => "{0, number, 0.00000 }"
- "0.000000" => "{0, number, 0.000000 }"
- "0.0000000" => "{0, number, 0.0000000}"
--- date ---
- "date" => "{0, date, dd.MM.YY}"
- "date : time" => "{0, date, dd.MM.YY} : {0, time, HH.mm.ss}"
- "dd.MM" => "{0, date, dd:MM}"
- "dd" => "{0, date, dd}"
- "... ... " in any place is substituted with "{0, date, dd.MM.YY}"
--- time ---
- "time" => "{0, time, HH:mm:ss}"
- "HH:mm" => "{0, time, HH:mm}"
- "mm:ss" => "{0, time, mm:ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "date, time" => "{0, date, dd.MM.YY\}, {0, time, HH.mm.ss}"
- "date,time" => "{0, date, dd.MM.YY\},{0, time, HH.mm.ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "... ... " in any place is substituted with "{0, time, HH.mm.ss}"
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.export method toS(matrix this, string format = "", string nz = na) => str.tostring(this.toStringMx(format, nz))
method toS(this, format, nz)
Converts each element of the matrix to string outputs using str.tostring(matrix)
Namespace types: matrix
Parameters:
this (matrix) : (matrix) Matrix to be converted to string
format (string) : (string) Format string as in str.format()
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.export method toS(matrix this, string format = "", string nz = na) => str.tostring(this.toStringMx(format, nz))
method toS(this, format, nz)
Converts each element of the matrix to string outputs using str.tostring(matrix)
Namespace types: matrix
Parameters:
this (matrix) : (matrix) Matrix to be converted to string
format (string) : (string) "HEX" (default) or "RGB"
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.export method toS(matrix this, string format = "", string nz = na) => str.tostring(this.toStringMx(format, nz))
method toS(this, format, nz)
Converts each element of the matrix to string outputs using str.tostring(matrix)
Namespace types: matrix
Parameters:
this (matrix) : (matrix) Matrix to be converted to string
format (string) : (string) (Optional) Format string. By default "{0}: {1}" if showIDs = true or "{1}" otherwise. (use "{0}" as a placeholder for id and "{1}" for item value)
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.export method toS(matrix this, string format = "", string nz = na) => str.tostring(this.toStringMx(format, nz))
method toS(this, format, nz)
Converts each element of the matrix to string outputs using str.tostring(matrix)
Namespace types: matrix
Parameters:
this (matrix) : (matrix) Matrix to be converted to string
format (string) : (string) (Optional) Format string. By default "{0}: {1}" if showIDs = true or "{1}" otherwise. (use "{0}" as a placeholder for id and "{1}" for item value)
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.export method toS(matrix this, string format = "", string nz = na) => str.tostring(this.toStringMx(format, nz))
method toS(this, format, nz)
Converts each element of the matrix to string outputs using str.tostring(matrix)
Namespace types: matrix
Parameters:
this (matrix) : (matrix) Matrix to be converted to string
format (string) : (string) (Optional) Format string. By default "{0}: {1}" if showIDs = true or "{1}" otherwise. (use "{0}" as a placeholder for id and "{1}" for item value)
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.export method toS(matrix this, string format = "", string nz = na) => str.tostring(this.toStringMx(format, nz))
Tostring
ToStringAr█ OVERVIEW
Contains to string conversion methods arrays of int/float/bool/string/line/label/box types
- toS() - method works like array.join() with more flexibility and
- toStringAr() - converts array to string on a per item basis and returns the resulting string array
Conversion of each item to string is made using toS() function from moebius1977/ToS/1 library.
█ GENERAL DESCRIPTION OF LIBRARY FUNCTIONS
All toS(array) methods have same parameters. The only difference will be in format parameter as explained below.
method toS(this, index_from, index_to, separator, showIDs, format, truncate_left, size_limit, nz)
Like array.join() but with string length limit. Joins elements into readable string (length capped at 4000, truncating the end or beg)
Parameters:
this (array) : array to be converted to string
index_from (int) : index_from (int) (Optional) Start from this id (starting from 0, in insertion order). If omitted - start from the first item.
index_to (int) : index_to (int) (Optional) End with this pair (inclusive, in insertion order). If omitted - to last item.
separator (string) : separator (string) (Optional) String to be inserted between pairs. Default: `", "`
showIDs (bool) : showIDs (bool) (Optional) If true item's id is added in the form `id: value`.
format (string) : format (string) (Optional) Format string fo toS(). If omitted default format is used depending in the type.
truncate_left (bool) : truncate_left (bool) (Optional) Truncate from left or right. Default: false.
size_limit (int) : size_limit (int) (Optional) Max output string length. Default: 4000.
nz (string) : nz (string) (Optional) A string used to represent na (na values are substituted with this string).
format parameter depends on the type:
For toS(bool/int/float ...) format parameter works in the same way as `str.format()` (i.e. you can use same format strings as with `str.format()` with `{0}` as a placeholder for the value) with some shorthand "format" options available:
--- number ---
- "" => "{0}"
- "number" => "{0}"
- "0" => "{0, number, 0 }"
- "0.0" => "{0, number, 0.0 }"
- "0.00" => "{0, number, 0.00 }"
- "0.000" => "{0, number, 0.000 }"
- "0.0000" => "{0, number, 0.0000 }"
- "0.00000" => "{0, number, 0.00000 }"
- "0.000000" => "{0, number, 0.000000 }"
- "0.0000000" => "{0, number, 0.0000000}"
--- date ---
- "... ... " in any place is substituted with "{0, date, dd.MM.YY}" (e.g. " " results in "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}")
- "date" => "{0, date, dd.MM.YY}"
- "date : time" => "{0, date, dd.MM.YY} : {0, time, HH.mm.ss}"
- "dd.MM" => "{0, date, dd:MM}"
- "dd" => "{0, date, dd}"
--- time ---
- "... ... " in any place is substituted with "{0, time, HH.mm.ss}" (e.g. " " results in "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}")
- "time" => "{0, time, HH:mm:ss}"
- "HH:mm" => "{0, time, HH:mm}"
- "mm:ss" => "{0, time, mm:ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "date, time" => "{0, date, dd.MM.YY\}, {0, time, HH.mm.ss}"
- "date,time" => "{0, date, dd.MM.YY\},{0, time, HH.mm.ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
For toS(line ...):
format (string) : (string) (Optional) Use `x1` as placeholder for `x1` and so on. E.g. default format is `"(x1, y1) - (x2, y2)"`.
For toS(label ...) :
format (string) : (string) (Optional) Use `x1` as placeholder for `x`, `y1 - for `y` and `txt` for label's text. E.g. default format is `(x1, y1): "txt"` if ptint_text is true and `(x1, y1)` if false.
For toS(box ... ) :
format (string) : (string) (Optional) Use `x1` as placeholder for `x`, `y1 - for `y` etc. E.g. default format is "(x1, y1) - (x2, y2)".
For toS(color] ... ) :
format (string) : (string) (Optional) Options are "HEX" (e.g. "#FFFFFF33") or "RGB" (e.g. "rgb(122,122,122,23)"). Default is "HEX".
All toStringAr() methods just convert each item to string using toS with same format options as described above.
Parameters:
arr (array) : Array to be converted to a string array.
format (string) : Format string.
nz (string) : Placeholder for na items.
█ FULL OF FUNCTIONS AND PARAMETERS
Library "ToStringAr"
Contains toString/toS conversion methods for int/float/bool/string/line/label/box and arrays and matrices thereof. Also contains a string wraping function.
method toS(this, index_from, index_to, separator, showIDs, format, truncate_left, size_limit, nz)
Namespace types: array
Parameters:
this (array)
index_from (int)
index_to (int)
separator (string)
showIDs (bool)
format (string)
truncate_left (bool)
size_limit (int)
nz (string)
method toS(this, index_from, index_to, separator, showIDs, format, truncate_left, size_limit, nz)
Namespace types: array
Parameters:
this (array)
index_from (int)
index_to (int)
separator (string)
showIDs (bool)
format (string)
truncate_left (bool)
size_limit (int)
nz (string)
method toS(this, index_from, index_to, separator, showIDs, format, truncate_left, size_limit, nz)
Namespace types: array
Parameters:
this (array)
index_from (int)
index_to (int)
separator (string)
showIDs (bool)
format (string)
truncate_left (bool)
size_limit (int)
nz (string)
method toS(this, index_from, index_to, separator, showIDs, format, truncate_left, size_limit, nz)
Namespace types: array
Parameters:
this (array)
index_from (int)
index_to (int)
separator (string)
showIDs (bool)
format (string)
truncate_left (bool)
size_limit (int)
nz (string)
method toS(this, index_from, index_to, separator, showIDs, format, truncate_left, size_limit, nz)
Namespace types: array
Parameters:
this (array)
index_from (int)
index_to (int)
separator (string)
showIDs (bool)
format (string)
truncate_left (bool)
size_limit (int)
nz (string)
method toS(this, index_from, index_to, separator, showIDs, format, truncate_left, size_limit, nz)
Namespace types: array
Parameters:
this (array)
index_from (int)
index_to (int)
separator (string)
showIDs (bool)
format (string)
truncate_left (bool)
size_limit (int)
nz (string)
method toS(this, index_from, index_to, separator, showIDs, format, truncate_left, size_limit, nz)
Namespace types: array
Parameters:
this (array)
index_from (int)
index_to (int)
separator (string)
showIDs (bool)
format (string)
truncate_left (bool)
size_limit (int)
nz (string)
method toS(this, index_from, index_to, separator, showIDs, format, truncate_left, size_limit, nz)
Namespace types: array
Parameters:
this (array)
index_from (int)
index_to (int)
separator (string)
showIDs (bool)
format (string)
truncate_left (bool)
size_limit (int)
nz (string)
method toStringAr(arr, format, nz)
Namespace types: array
Parameters:
arr (array)
format (string)
nz (string)
method toStringAr(arr, format, nz)
Namespace types: array
Parameters:
arr (array)
format (string)
nz (string)
method toStringAr(arr, format, nz)
Namespace types: array
Parameters:
arr (array)
format (string)
nz (string)
method toStringAr(arr, format, nz)
Namespace types: array
Parameters:
arr (array)
format (string)
nz (string)
method toStringAr(arr, format, nz)
Namespace types: array
Parameters:
arr (array)
format (string)
nz (string)
method toStringAr(arr, format, nz)
Namespace types: array
Parameters:
arr (array)
format (string)
nz (string)
method toStringAr(arr, format, nz)
Namespace types: array
Parameters:
arr (array)
format (string)
nz (string)
method toStringAr(arr, format, nz)
Namespace types: array
Parameters:
arr (array)
format (string)
nz (string)
ToClrToStrContains functions for conversion of color to string and vice versa:
method toClr( string this ) - converts string reperesentation of color (in hex format) to color
method toHex( color this ) - converts color to string (hex form)
method toRgb( color this ) - converts color to string ("rgb(11,11,11,0)" form)
Thanks to @ImmortalFreedom for his `color_tostring()` function from "RGB Color Fiddler"
ColorUtility for working with colors.
Get the luminosity of a color and determine the optimal (black or white) foreground color.