Clear Structure Keys in Coldfusion

Generally, If we want to clear keys value of any structure then we take it as list and use loop to clear data. That’s a good way for cle aring keys value of structure inspite we do it manually. Below is the code to do it in a simple way.

[code:cf]<cfset str.firstname = ‘ABC’>
<cfset str.lastname = ‘XYZ’>
<cfset str.role = ‘ADMIN’>
<cfdump var="#str#">
<cfoutput>
<cfloop collection=#str# item="person">
<cfset str[person] = ”>
</cfloop>
</cfoutput>
<cfdump var="#str#">[/code]

View Demo