Parameter
Last updated on
Oct 27, 2023
Description
Determines whether a struct is ordered or not.
Returns
True, if the input struct is ordered.
Category
History
ColdFusion (2018 release): Added this function.
Syntax
StructIsOrdered(struct)
See also
Structure functions; Structure functions in the Developing ColdFusion Applications guide.
Parameters
|
Description |
Struct |
Input struct object. |
Example
<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>
Output
YES
YES
YES
YES
YES
YES
YES
YES