Tostring - MACROMEDIA COLDFUSION 4.5-CFML LANGUAGE Reference

Cfml language reference
Table of Contents

Advertisement

Chapter 2: ColdFusion Functions

ToString

Attempts to convert a value of any type, including a binary value, into a string.
Syntax
ToString( any_value )
any_value
The value that is to be converted into a string.
Usage
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.
Examples
<!--- 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>
547

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-CFML LANGUAGE and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Coldfusion 4.5

Table of Contents