ToString

Converts a value to a string.

Method Signature

ToString(value=[any], encoding=[string])

Arguments

Argument
Type
Required
Description
Default

value

any

true

Value to convert to a string; can be a simple value such as an integer, a binary object, or an XML document object.

encoding

string

false

The character encoding (character set) of the string, used with binary data.

Examples

Base64 value to binary to string

Run Example

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

Result: Expected Result: stringValue

Structure to String

Run Example

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

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

Member syntax

Run Example

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

Result: 42

Additional Examples

Run Example

writeDump( toString( 45 ) );
dt = now();
writeDump( toString( dt ) );

Run Example

number = randrange( 1, 10 );
writeDump( number.toString() );
dt = now();
writeDump( dt.toString() );

Last updated

Was this helpful?