toString

Converts a value to a string.
Lucee parses numbers with one decimal place.
complex object types can only be used in combination with the member syntax.

toString(any_value [, encoding]) → returns string

Member Function Syntax

any_value.toString()

toString Argument Reference

any_value any
Required

Value to convert to a string

encoding string

The character encoding (character set) of the string.

The default value is the encoding of the page on which the function is called.
Values:
  • utf-8
  • iso-8859-1
  • windows-1252
  • us-ascii
  • shift_jis
  • iso-2022-jp
  • euc-jp
  • euc-kr
  • big5
  • euc-cn
  • utf-16

Examples sample code invoking the toString function

base64Value = toBase64( "stringValue" );
binaryValue = toBinary( base64Value );
stringValue = toString( binaryValue );
writeDump(stringValue);

Expected Result: Expected Result: stringValue

s = {
    "a": "1",
    "b":"2"
};
writeOutput(toString(s));

Expected Result: {a={1},b={2}}

toString as a method

num = 42;
writeOutput(num.toString());

Expected Result: {a={1},b={2}}


Fork me on GitHub