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
base64Value = toBase64( "stringValue" );
binaryValue = toBinary( base64Value );
stringValue = toString( binaryValue );
writeOutput( stringValue );
Result: Expected Result: stringValue
Structure to String
s = {
"a" : "1",
"b" : "2"
};
writeOutput( toString( s ) );
Result: {a={1},b={2}}
Member syntax
num = 42;
writeOutput( num.toString() );
Result: 42
Additional Examples
writeDump( toString( 45 ) );
dt = now();
writeDump( toString( dt ) );
number = randrange( 1, 10 );
writeDump( number.toString() );
dt = now();
writeDump( dt.toString() );
Related
Last updated
Was this helpful?