Attempts to convert a value of any type, including a binary value, into a string.
ToString(any_value)
The value that is to be converted into a string.
If ToString cannot convert the value into a string, it throws an exception. All simple values can be converted into a string, even binary values that do not contain byte zero can be converted.
<!--- This example shows the use of ToBase64, ToBinary and ToString ---> <HTML> <HEAD> <TITLE> ToString Example </TITLE> </HEAD> <BODY BGCOLOR=silver> <H3>ToString Example</H3> <!---------------------------------------------------------------------- Initialize data. -----------------------------------------------------------------------> <CFSET charData =""> <!---------------------------------------------------------------------- Create a string of all ASCII characters (32-255) and concatenate them together. -----------------------------------------------------------------------> <CFLOOP index="data" from="32" to="255"> <CFSET ch=chr(data)> <CFSET charData=charData & ch> </CFLOOP> <P> The following string is the concatenation of all characters (32 to 255) from the ASCII table.<BR> <CFOUTPUT>#charData#</CFOUTPUT> </P> <!---------------------------------------------------------------------- Create a Base 64 representation of this string. -----------------------------------------------------------------------> <CFSET data64=toBase64(#charData#)> <P> The following string is the Base 64 representation of the original string.<BR> <CFOUTPUT>#data64#</CFOUTPUT> </P> <!---------------------------------------------------------------------- Create a binary representation of Base 64 data. -----------------------------------------------------------------------> <CFSET dataBinary=toBinary(data64)> <!---------------------------------------------------------------------- Create the string repesentation of the binary data. -----------------------------------------------------------------------> <CFSET dataString=toString(dataBinary)> <P> The following is the string representation of the binary data.<BR> <CFOUTPUT>#dataString#</CFOUTPUT> </P> </BODY> </HTML>