TOTEXT function

TOTEXT(Value) TOTEXT(Value)

Value

Number, Logical, Text, Color, { Number }, { Logical }, { Text } or { Color }

The value to convert.

Returns

Text or { Text }

A string corresponding to the given value.

Returns the given value converted to a text string. TOTEXT(42)TOTEXT(42) returns "42".

When the sole parameter is a text string, it is returned unchanged. When it is a logical value, FALSE is converted to "FALSE" and TRUE is converted to "TRUE".

The language settings of the app are taken into account when converting numbers, meaning that an app configured to use German uses a decimal comma (",") as a decimal separator and an app configured to use Australian English uses a decimal point ("."). Thousands separators are not used and negative numbers use a leading minus sign ("-"). The result, in other words, is such that it can be parsed by the TONUMBER function. Use FORMATNUMBER instead for more options, including support for thousands separators.

When the value is a color, a hex string is used, of the type also used by Cascading Style Sheets (CSS) (and which can be parsed by the COLOR and TOCOLOR functions). For instance, TOTEXT(Color.Red)TOTEXT(Color,Red) is converted to "#ff0000". If the color is not fully opaque (that is, if the color is partly transparent), an additional two characters are used to convey the alpha value of the color. For more details, refer to the COLOR function and its section on "Hex notation."

This function is specific to Calcapp.

Examples

TOTEXT(42.1)TOTEXT(42,1)

Returns "42.1", if the decimal separator of the language the app is configured to use is a decimal point and "42,1", if the decimal separator of the language the app is configured to use is a decimal comma.

TOTEXT(FALSE)TOTEXT(FALSE)

Returns "FALSE".

TOTEXT(TRUE)TOTEXT(TRUE)

Returns "TRUE".

TOTEXT(Color.Red)TOTEXT(Color,Red)

Returns "#ff0000".

TOTEXT(COLOR("rgba(255, 0, 0, 0.5"))TOTEXT(COLOR("rgba(255, 0, 0, 0.5"))

Returns "#ff00007f".