home *** CD-ROM | disk | FTP | other *** search
- <!--- This example shows the use of ToBase64, ToBinary and ToString --->
- <html>
- <head>
- <title>
- ToString Example
- </title>
- </head>
-
- <BASEFONT FACE="Arial, Helvetica" SIZE=2>
- <BODY bgcolor="#FFFFD5">
-
- <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>
-