coerce.to-string

coerce.to-string attempts to parse unknown data to a string. It is a flexible method, and will attempt to take any primitive data type and encode it as a string.

Function category: Coercion

Syntax

coerce.to-string(arg1, arg2)

Arguments

Description

arg1

Any date.

arg2

Optional. A format string.

Examples

Example 1: Specify a time output format for string

If we have a function that includes a time output, such as DATE, as an argument, this function returns a string based on the format specified.

# Date to string
coerce.to-string(DATE(1988, 8, 21), 'MMM-yy-dd')
# Returns AUG-88-21

Example 2: Boolean to string

If we have a function that is given a Boolean as its argument, this function returns a string value.

# Boolean to string
coerce.to-string(true)
# Returns "true"

Example 3: Integer to string

If we have a function that is given an integer as an argument, this function returns a string.

# Integer to string
coerce.to-string(1.1)
# Returns "1.1"

Notes