Parameter
Determines whether a struct is ordered or not.
True, if the input struct is ordered.
ColdFusion (2018 release): Added this function.
StructIsOrdered(struct)
Structure functions; Structure functions in the Developing ColdFusion Applications guide.
|
Parameter |
Description |
|
Struct |
Input struct object. |
<cfscript>
// create an ordered struct
myStruct1=StructNew("ordered");
myStruct2 = [ a=1, b=2, d=4, c=3 ];
mystruct3=StructNew("ordered","text","asc");
mystruct4= structNew("ordered", function(e1value,e2value,e1key,e2key)
{
return compare(e1key,e2key);
});
// Check whether struct is ordered
writeOutput(StructIsOrdered(myStruct1) & "<br>");
writeOutput(StructIsOrdered(myStruct2) & "<br>");
writeOutput(StructIsOrdered(myStruct3) & "<br>");
writeOutput(StructIsOrdered(myStruct4) & "<br>");
// Using member function
writeOutput(myStruct1.IsOrdered() & "<br>");
writeOutput(myStruct2.IsOrdered() & "<br>");
writeOutput(myStruct3.IsOrdered() & "<br>");
writeOutput(myStruct4.IsOrdered() & "<br>");
</cfscript>
YES
YES
YES
YES
YES
YES
YES
YES
Sign in to your account