Convert expr to a float. Also ensures this is a copy.
Example:
# Example for as_bigf
println as_bigf("3.14159265358979323846")
Convert expr to a big integer. Also ensures this is a copy.
Example:
# Example for as_bigi
println as_bigi("12345678901234567890")
Convert string to a boolean value, or errors
Example:
# Example for as_bool
println as_bool("true")
Convert var to a float. Returns NaN on error.
Example:
# Example for as_float
println as_float("3.14159")
Convert var to an integer, or errors.
Example:
# Example for as_int
println as_int("42")
Convert var to an int64 type, or errors.
Example:
# Example for as_int64
println as_int64("42")
Converts value to a string.
Example:
# Example for as_string println as_string(42)
Convert var to a uint type, or errors.
Example:
# Example for as_uint
println as_uint("42")
Return a numeric representation of the first char in string.
Example:
# Example for asc
println asc("A")
Return a string of the base64 decoding of string
Example:
# Example for base64d
encoded = base64e("Hello World")
println base64d(encoded)
Return a string of the base64 encoding of string
Example:
# Example for base64e
println base64e("Hello World")
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)
Convert to a uint8 sized integer, or errors.
Example:
# Example for byte println byte(65) println byte(97)
Return a string representation of ASCII char int. Representations above 127 are empty.
Example:
# Example for char println char(42)
Convert decimal int to octal string.
Example:
# Example for dtoo println dtoo(42)
Converts false to nil or returns true.
Example:
# Example for f2n println f2n(true)
Format a number as currency with comma separators, 2 decimal places, and optional currency symbol (default $).
Example:
# Example for format_currency println format_currency(3.14)
Decodes a hex-encoded string and returns the resulting byte array, or an error if the string is not valid hex.
Example:
# Example for hex_decode
println hex_decode("48656c6c6f20576f726c64")
Returns the hex-encoded representation of a string or byte array.
Example:
# Example for hex_encode
hex = hex_encode("Hello World")
println hex
println hex_decode(hex)
Converts a byte count to a human-readable string (B, KB, MB, GB, TB).
Example:
# Example for human_size println human_size(1024)
Returns true if expression can evaluate to a numeric value.
Example:
# Example for is_number
println is_number("42")
println is_number("hello")
println is_number("3.14")
Return a boolean which is set to true when int is non-zero.
Example:
# Example for itob println itob(42)
Decode a JSON string into a map (objects) or array (JSON arrays).
Example:
# Example for json_decode
println json_decode("{\"a\": 1}")
Convert value to a JSON string.
Example:
# Example for json_encode println json_encode(map(.a 1, .b 2))
Return a formatted JSON representation of string, or an empty string on error.
Example:
# Example for json_format
println json_format("{\"a\":1}")
Returns the result of processing input_string using the gojq library.
query_string is a jq-like query to operate with. If map_bool is false (default)
then a string is returned, otherwise an iterable list is returned.
Example:
# Example for json_query
json_query("{\"a\": 1}", ".a")
Convert a map to struct following field form of struct_example.
Example:
# Example for m2s r = sys_resources() m = s2m(r) println m2s(m, r)
Represents the maximum possible uint value.
Example:
# Example for maxuint println maxuint()
Converts simple markdown syntax to Za ANSI colour codes.
Example:
# Example for md2ansi
println md2ansi("# Hello")
Convert octal string to decimal int.
Example:
# Example for otod
println otod("10")
Pretty print a map or slice with optional indentation, depth limit, and colour-coded section headings.
Example:
# Example for pp pp(map(.a 1))
Read a struct from a file.
Example:
# Example for read_struct
r = sys_resources()
write_struct("/tmp/za_struct.bin", "r")
read_struct("/tmp/za_struct.bin", "r")
Convert a struct to map.
Example:
# Example for s2m r = sys_resources() println s2m(r)
Alias for as_string(). Converts a value to a string.
Example:
# Example for str println str(42)
Convert a slice of maps/structs to a text table, or parse a string to structured data.
Example options: .parse_only false (return [][]any), .has_headers false, .detect_sep true, .separator ",",
.hide ["field1"], .show_only_ordered true, .colours map(.header "[#code1]", .data "[#code2]"),
.table_width 80, .column_widths map(.name 10), .align map(.name "left"), .include_headers true,`
.border_style "ascii", .truncate false, .column_order ["col1", "col2"])
Example:
# Example for table
table("hello") # usage
Convert value to the specified type type_string. Supports multi-dimensional arrays like '[][]int', '[][][]string', '[5][3]int', etc.
Example:
# Example for to_typed println to_typed([1, 2, 3], "[]int")
Alias for kind(). Return a string indicating the type of the variable.
Example:
# Example for type
println type(42)
println type("hello")
println type([1, 2, 3])
Alias for kind(). Return a string indicating the type of the variable.
Example:
# Example for typeof
println typeof(42)
println typeof("hello")
println typeof([1, 2, 3])
Returns a URL-decoded version of the input string, or an error if the input is not valid.
Example:
# Example for url_decode
encoded = url_encode("hello world!")
println url_decode(encoded)
Returns a URL-encoded (percent-encoded) version of the input string.
Example:
# Example for url_encode
println url_encode("hello world!")
Sends a struct to file. Returns byte size written.
Example:
# Example for write_struct
r = sys_resources()
write_struct("/tmp/za_struct.bin", "r")