Convert expr to a float. Also ensures this is a copy.
Convert expr to a big integer. Also ensures this is a copy.
Convert string to a boolean value, or errors
Convert var to a float. Returns NaN on error.
Convert var to an integer, or errors.
Convert var to an int64 type, or errors.
Converts value to a string.
Convert var to a uint type, or errors.
Return a numeric representation of the first char in string.
Example:
# Example for asc
println asc("A") # 65
Return a string of the base64 decoding of string
Example:
println base64d("VGhlIEJhbnlhbiBUcmVl")
`
produces:
The Banyan Tree
`
Return a string of the base64 encoding of string
Example:
println base64e("The Banyan Tree")
`
produces:
VGhlIEJhbnlhbiBUcmVl
`
Return an int which is either 1 when bool is true or else 0 when bool is false.
Example:
# Example for btoi println btoi(true) # 1
Convert to a uint8 sized integer, or errors.
Return a string representation of ASCII char int. Representations above 127 are empty.
Convert decimal int to octal string.
Example:
# Example for dtoo println dtoo(8) # 10
Converts false to nil or returns true.
Returns true if expression can evaluate to a numeric value.
Example:
# Example for is_number
println is_number("123") # true
Return a boolean which is set to true when int is non-zero.
Example:
# Example for itob println itob(1) # true
Return a mixed type array representing a JSON string.
Example:
# Example for json_decode
println json_decode("[1,2,3]") # [1,2,3]
Return a formatted JSON representation of string, or an empty string on error.
Example:
# Example for json_format
json='{"a":1,"b":2}'
println json_format(json)
Returns the result of processing input_string using the gojq library.
[#SOL]query_string is a jq-like query to operate with. If map_bool is false (default)
[#SOL]then a string is returned, otherwise an iterable list is returned.
Example:
# Example for json_query
var data='{"a":[1,2,3]}'
println json_query(data,".a") # [1,2,3]
Convert a map to struct following field form of struct_example.
Represents the maximum possible uint value.
Converts simple markdown syntax to Za ANSI colour codes.
Convert octal string to decimal int.
Example:
# Example for otod
println otod("77") # 63
Pretty print a map or slice with optional indentation, depth limit, and colour-coded section headings.
Read a struct from a file.
Example:
# Example for read_struct
println read_struct("/tmp/struct","s")
Convert a struct to map.
Convert a slice of maps/structs to a text table, or parse a string to structured data.
[#SOL]Example options: .parse_only false (return [][]any), .has_headers false, .detect_sep true, .separator ",",
[#SOL].hide ["field1"], .show_only_ordered true, .colours map(.header "[#code1]", .data "[#code2]"),
[#SOL].table_width 80, .column_widths map(.name 10), .align map(.name "left"), .include_headers true,`
[#SOL].border_style "ascii", .truncate false, .column_order ["col1", "col2"])
Convert value to the specified type type_string. Supports multi-dimensional arrays like '[][]int', '[][][]string', '[5][3]int', etc.
Sends a struct to file. Returns byte size written.
Example:
# Example for write_struct
var x={a:1,b:2}
println write_struct("/tmp/struct","x") # bytes written