Skip to main content

Conversion functions

Function List:

Boolean

Boolean(x): Represents x as a boolean value.

Boolean(10)         // true
Boolean(true) // true
Boolean("true") // true
Boolean("y") // true

Boolean(0) // false
Boolean(false) // false
Boolean("false") // false
Boolean("abc") // false
Boolean("n") // false
Boolean(null) // false
Boolean("") // false

DateParse

DateParse(s): Constructs and returns a date based on string pattern s.

DateParse("20120227T132700")    // 2012-02-27 13:27:00.000

ParseQnum

ParseQnum(s): Parses a qualified number from string s.

ParseQnum("10")
ParseQnum("<10")
ParseQnum(" > 10")

Qnum

Qnum(x, q): Returns a qualified number with value x and qualifier q.

Qnum(1, "=")
Qnum(2, "<")
Qnum(3, ">")

QnumToString

QnumToString(x): Converts a qualified number to a string representation.

QnumToString(Qnum(1.5, "<"))  // <1.50

TimeSpanParse

TimeSpanParse(s): Constructs and returns a TimeSpan based on string pattern s.

TimeSpanParse("01:00")    //  Creates a time interval of one hour

ToString

ToString(x): Returns a string representation of number x.

ToString(3.14)    //  "3.14"