StructKeyArray

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

StructKeyArray( struct )

Returns: Array

Argument Description
struct
struct, required

Structure from which to extract a list of keys

Alias: structure, object

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