To delete a key and its value from a structure, use the StructDelete function, as follows:
StructDelete(structure_name, key [, indicateNotExisting ])
The indicateNotExisting argument tells the function what to do if the specified key does not exist. By default, the function always returns True. However, if you specify True for the indicateNotExisting argument, the function returns True if the key exists and False 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, as follows:
StructClear(structure_name)
If you use StructClear to delete a structure that you have copied using the StructCopy function, the specified structure is deleted, but the copy is unaffected.
If you use StructClear to delete a structure that has a multiple references, the function deletes the contents of the structure and all references point to the empty structure, as the following example shows:
<cfset myStruct.Key1="Adobe"> Structure before StructClear<br> <cfdump var="#myStruct#"> <cfset myCopy=myStruct> <cfset StructClear(myCopy)> After Clear:<br> myStruct: <cfdump var="#myStruct#"><br> myCopy: <cfdump var="#myCopy#">