Copying Structures; Deleting Structures - MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual

Developing web applications with coldfusion
Table of Contents

Advertisement

116
But if the key is dynamic, or contains special characters, you must use the
StructKeyExists function:
<CFSET temp=StructKeyExists( structure_name, key )>
Getting a list of keys in a structure
To get a list of the keys in a CFML structure, you use the StructKeyList function:
<CFSET temp=StructKeyList( structure_name, [ delimiter ] )>
The delimiter can be any delimiter, but the default is a comma ( , ).
The StructKeyArray function returns an array of keys in a structure:
<CFSET temp=StructKeyArray( structure_name )>
Note

Copying structures

To copy a structure, use the StructCopy function. This function takes the name of the
structure you want to copy and returns a new structure with all the keys and values of
the named structure.
StructCopy( structure )
This function throws an exception if structure doesn't exist.
Use the StructCopy function when you want to create a physical copy of a structure.
You can also use assignment to create a copy by reference.

Deleting structures

To delete an individual name-value pair in a structure, use the StructDelete function:
StructDelete( structure_name, key [ , indicatenotexisting ])
This deletes the named key and its associated value. Note that the indicatenotexisting
parameter indicates whether the function returns FALSE if the named key does not
exist. The default is FALSE, which means that the function returns Yes regardless of
whether key exists. If you specify TRUE for this parameter, the function returns Yes if
key exists and No if it does not.
You can also use the StructClear function to delete all the data in a structure but keep
the structure instance itself:
StructClear( structure_name )
The StructKeyList and StructKeyArray functions do not return keys in any
particular order. Use the ListSort or ArraySort function to sort the results.
Developing Web Applications with ColdFusion

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion 4.5

Table of Contents