Utility Function: StructDeleteKeys()
- January 19, 2009 10:14 AM
- Utility Function
- Comments (0)
I often need to delete struct keys based on a list of items. Its not that I can't just loop the list and call StructDelete(), but it gets old, and this function makes it a little easier.
<cffunction name="StructDeleteKeys" returntype="void">
<cfargument name="struct" type="struct" requried="true" />
<cfargument name="keyList" type="string" requried="true" />
<cfargument name="delimiters" type="string" required="false" default="," />
<cfloop list="#arguments.keyList#" delimiters="#arguments.delimiters#" index="key">
<cfset StructDelete(arguments.struct, key) />
</cfloop>
<cfreturn />
</cffunction>
<cfargument name="struct" type="struct" requried="true" />
<cfargument name="keyList" type="string" requried="true" />
<cfargument name="delimiters" type="string" required="false" default="," />
<cfloop list="#arguments.keyList#" delimiters="#arguments.delimiters#" index="key">
<cfset StructDelete(arguments.struct, key) />
</cfloop>
<cfreturn />
</cffunction>