Skip to content

TO_STRING

Info

New in Atfinity 17.

Description

TO_STRING converts a value to its string representation. Booleans are rendered as true and false. A number with a unit is rendered as its plain number, dropping the unit.

Most string operators already coerce a number to text automatically (for example CHARS(1024) and CONCAT(1, 2) work without a cast), so TO_STRING is only needed for the operators that do not coerce — SLICE, LEFT, and RIGHT — where a number would otherwise be returned unchanged.

Syntax

TO_STRING(value)

Returns: a string.

Example

TO_STRING(42)

This returns '42'.

SLICE(TO_STRING(20240115), 0, 4)

This returns '2024'. Without TO_STRING, SLICE would receive an integer and return it unchanged.