structKeyList

Extracts keys from a CFML structure.

structKeyList(structure [, delimiter]) → returns string

Member Function Syntax

someStruct.keyList([delimiter])

Argument Reference

structure struct
Required

Structure from which to extract a list of keys

delimiter string
Default: ,

Character that separates keys in list. Default: comma.

Links more information about structKeyList

Examples
Sample code invoking the structKeyList function

Retrieve a pipe separated list of keys

statusCodes = {
    OK = 200,
    CREATED = 201,
    NOT_MODIFIED = 304,
    BAD_REQUEST = 400,
    NOT_FOUND = 404
};

writeDump(structKeyList(statusCodes, " | "));

Expected Result: "OK | CREATED | NOT_MODIFIED | BAD_REQUEST | NOT_FOUND"

CF 11+ Lucee 4.5+ 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.keyList());

Expected Result: "OK,CREATED,NOT_MODIFIED,BAD_REQUEST,NOT_FOUND"

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub