How To The Write `structKeyList( structure, delimiter )` Function In ColdFusion?
Description:-
This is used to get the key list from a ColdFusion structure.
structKeyList( structure, delimiter );
This function returns a list that consists of structure key names.
Member Function Syntax:-
structure.keyList( delimiter );
Attributes:-
Structure:-
This is a required argument, a structure
from which to extract the list of keys.
delimiter:-
This is a non-required argument, a character that separates keys in the list. The default value is ,
.
Example:-
test = {
"a" : 100,
"b" : 200,
"c" : 300,
"d" : 400,
"e" : 500
};
writeDump( structKeyList( test, "-" ) );
Result:-
a-b-c-d-e
An example by using a member function:-
test = {
"a" : 100,
"b" : 200,
"c" : 300,
"d" : 400,
"e" : 500
};
writeDump( test.keyList( ) );
Result:-
a,b,c,d,e
Conclusion: We can use this function in a large, unknown ColdFusion structure to gain some insight, like .prc
in ColdBox.