system.convert

Type conversion functions for the Quartz programming language.

Import

import system.convert as conv;

Functions

to_string(value) → string

Convert any value to its string representation.

conv.to_string(42)      // "42"
conv.to_string(3.14)    // "3.14"
conv.to_string(true)    // "true"

to_int(s: string) → int

Parse a string to an integer.

conv.to_int("42")       // 42
conv.to_int("-17")      // -17

to_double(s: string) → double

Parse a string to a double.

conv.to_double("3.14")  // 3.14
conv.to_double("2.5e10") // 2.5e10

to_bool(value) → bool

Convert a value to boolean.

conv.to_bool(1)         // true
conv.to_bool(0)         // false
conv.to_bool("true")    // true