StructKeyArray

Finds the keys in a struct. An array of keys; if structure does not exist, CFML throws an exception.

Returns: array

Usage

StructKeyArray( structure )

Arguments

Argument Description
structure
(struct, required)

Structure from which to extract a list of keys

Examples

Member Function

animals = {
	cow: "moo",
	pig: "oink",
	cat: "meow",
	bird: "chirp"
};

// animals.keyArray()
animalKeyArray = animals.keyArray();

// Show results of animalKeyArray
// ["bird","cat","cow","pig"]
for (animal in animalKeyArray) {
	// Show value of animal in animals
	Dump(
		label: "Value of " & animal,
		var: animals[animal]
	);
}

Non-Member Function

animals = {
	cow: "moo",
	pig: "oink",
	cat: "meow",
	bird: "chirp"
};

// StructKeyArray(animals)
animalKeyArray = StructKeyArray(animals);

// Show results of animalKeyArray
// ["bird","cat","cow","pig"]
for (animal in animalKeyArray) {
	// Show value of animal in animals
	Dump(
		label: "Value of " & animal,
		var: animals[animal]
	);
}

See also