StructIsOrdered

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 functionsStructure functions in the Developing ColdFusion Applications guide.

Parameters

Parameter

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

 Adobe

Dapatkan bantuan lebih cepat dan lebih mudah

Pengguna baru?

Adobe MAX 2024

Adobe MAX
Konferensi Kreativitas

14–16 Oktober Miami Beach dan online

Adobe MAX

Konferensi Kreativitas

14–16 Oktober Miami Beach dan online

Adobe MAX 2024

Adobe MAX
Konferensi Kreativitas

14–16 Oktober Miami Beach dan online

Adobe MAX

Konferensi Kreativitas

14–16 Oktober Miami Beach dan online