Chapter 2: ColdFusion Functions
547
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>
Summary of Contents for COLDFUSION 4.5-CFML LANGUAGE
Page 1: ...Allaire Corporation CFML Language Reference ColdFusion 4 5...
Page 207: ...Chapter 1 ColdFusion Tags 183 CFCATCH CFTRY BODY HTML...
Page 224: ...200 CFMLLanguageReference CFOUTPUT P Text within CFOUTPUT is always shown CFOUTPUT BODY HTML...
Page 336: ...312 CFMLLanguageReference CFIF BODY HTML...
Page 404: ...380 CFMLLanguageReference DE It is morning CFOUTPUT P BODY HTML...
Page 413: ...Chapter 2 ColdFusion Functions 389 Customer BalanceDue BR CFOUTPUT CFIF BODY HTML...
Page 483: ...Chapter 2 ColdFusion Functions 459 CFOUTPUT CFLOOP BODY HTML...
Page 584: ...560 CFMLLanguageReference...
Page 594: ...570 CFMLLanguageReference...