StructKeyArray
Get keys of a struct as an array
Method Signature
StructKeyArray(structure=[structloose])
Arguments
Argument
Type
Required
Description
Default
structure
struct
true
Examples
Traditional function
statusCodes = {
OK : 200,
CREATED : 201,
NOT_MODIFIED : 304,
BAD_REQUEST : 400,
NOT_FOUND : 404
};
writeDump( structKeyArray( statusCodes ) );
Result: [NOT_FOUND, BAD_REQUEST, CREATED, OK, NOT_MODIFIED]
Using Member Function
Retrieve a comma separated list of keys using the member function
statusCodes = {
OK : 200,
CREATED : 201,
NOT_MODIFIED : 304,
BAD_REQUEST : 400,
NOT_FOUND : 404
};
writeDump( statusCodes.keyArray() );
Result: [NOT_FOUND, BAD_REQUEST, CREATED, OK, NOT_MODIFIED]
Additional Examples
animals = {
COW : "moo",
PIG : "oink",
CAT : "meow",
BIRD : "chirp"
};
dump( StructKeyArray( animals ) );
animals = [
COW : "moo",
PIG : "oink",
CAT : "meow",
BIRD : "chirp"
];
dump( StructKeyArray( animals ) );
Related
Last updated
Was this helpful?