![MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual Download Page 142](http://html1.mh-extra.com/html/macromedia/coldfusion-4-5-developing-web/coldfusion-4-5-developing-web_develop-manual_3286369142.webp)
116
Developing Web Applications with ColdFusion
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
The StructKeyList and StructKeyArray functions do not return keys in any
particular order. Use the ListSort or ArraySort function to sort the results.
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
)
Summary of Contents for COLDFUSION 4.5-DEVELOPING WEB
Page 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Page 14: ...xiv Developing Web Applications with ColdFusion...
Page 26: ...xxvi Developing Web Applications with ColdFusion...
Page 34: ...8 Developing Web Applications with ColdFusion...
Page 70: ...44 Developing Web Applications with ColdFusion...
Page 84: ...58 Developing Web Applications with ColdFusion...
Page 114: ...88 Developing Web Applications with ColdFusion...
Page 148: ...122 Developing Web Applications with ColdFusion...
Page 174: ...148 Developing Web Applications with ColdFusion...
Page 208: ...182 Developing Web Applications with ColdFusion...
Page 244: ...218 Developing Web Applications with ColdFusion...
Page 274: ...248 Developing Web Applications with ColdFusion...
Page 288: ...262 Developing Web Applications with ColdFusion...
Page 300: ...274 Developing Web Applications with ColdFusion...
Page 350: ...324 Developing Web Applications with ColdFusion...
Page 362: ...336 Developing Web Applications with ColdFusion...