How to count the keys of a structure in ColdFusion

StructCount() - count the keys in a structure

StructCount.cfm


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>StructCount function example: how to count the keys in a structure</title>
</head>

<body>
<h2 style="color:HotPink">StructCount Function Example</h2>

<cfset Color=StructNew()>
<cfset Color.ID=1>
<cfset Color.Name="LavenderBlush">
<cfset Color.Value="##FFF0F5">
<cfdump var="#Color#" label="Color">

<br />
<cfoutput>
<b>
Color[key count]: #StructCount(Color)#
</b>
</cfoutput>
</body>
</html>





More ColdFusion examples