CFLib.org – Common Function Library Project

clearStructureNested(s)

Last updated January 28, 2005

author

Qasim Rasheed

Version: 1 | Requires: CF6 | Library: DataManipulationLib

Description:
This function recurse through a structure and makes all fields as empty string

Return Values:
Returns a structure.

Example:

<cfset foo = structnew()>
<cfset foo.foo = structnew()>
<cfset foo.foo.foo = "bar">
<cfset foo.test = "bar">
<cfset clearStructureNested( foo )>
<cfdump var="#foo#">

Parameters:

Name Description Required
s Structure to clear. Yes

Full UDF Source:

<!---
 This function recurse through a structure and makes all fields as empty string
 
 @param s 	 Structure to clear. (Required)
 @return Returns a structure. 
 @author Qasim Rasheed (qasimrasheed@hotmail.com) 
 @version 1, January 28, 2005 
--->
<cffunction name="clearStructureNested" returntype="void" output="false">
	<cfargument name="s" type="struct" required="true" />
	<cfset var i = "">
	<cfloop collection="#arguments.s#" item="i">
		<cfif isstruct(arguments.s[i])>
			<cfset clearStructureNested(arguments.s[i])>
		<cfelse>
			<cfset structupdate(arguments.s, i,"")>
		</cfif>
	</cfloop>
</cffunction>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson