Adobe COLDFUSION 9 Manual page 42

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
The CFML Programming Language
Special characters
The double-quotation marks ("), single-quotation mark ('), and number sign (#) characters have special meaning to
ColdFusion. To include any of them in a string, double the character; for example, use ## to represent a single #
character.
The need to escape the single- and double-quotation marks is context sensitive. Inside a double-quoted string, you do
not need to escape single-quotation mark (apostrophe) characters. Inside a single-quoted string, you do not escape
double-quotation mark characters.
The following example illustrates escaping special characters, including the use of mixed single- and double-quotation
marks:
<cfset mystring = "We all said ""Happy birthday to you.""">
<cfset mystring2 = 'Then we said "How old are you now?"'>
<cfoutput>
#mystring#<br>
#mystring2#<br>
Here is a number sign: ##
</cfoutput>
The output looks as follows:
We all said "Happy birthday to you."
Then we said "How old are you now?"
Here is a number sign: #
Reserved words
As with any programming tool, you cannot use just any word or name for ColdFusion variables, UDFs and custom
tags. Avoid using any name that can be confused with a ColdFusion element. In some cases, if you use a word that
ColdFusion uses—for example, a built-in structure name—you can overwrite the ColdFusion data.
The following list indicates words you must not use for ColdFusion variables, user-defined function names, or custom
tag names. While some of these words can be used safely in some situations, you can prevent errors by avoiding them
entirely. For a complete list of reserved words, see the CFML Reference.
• Built-in function names, such as Now or Hash
• Scope names, such as Form or Session
• Any name starting with cf. However, when you call a CFML custom tag directly, you prefix the custom tag page
name with cf_.
• Operators, such as NE or IS
• The names of any built-in data structures, such as Error or File
• The names of any built-in variables, such as RecordCount or CGI variable names
• CFScript language element names such as for, default, or continue
Also, do not create form field names ending in any of the following, except to specify a form field validation rule using
a hidden form field name. (For more information on form field validation, see
Formatting
Data" on page 703.)
• _integer
• _float
• _range
Last updated 8/5/2010
"Introduction to Retrieving and
37

Advertisement

Table of Contents
loading

Table of Contents