StructDelete()
Removes an element from a structure.
Since Lucee 6, the member function .delete() now returns the modified struct
StructDelete( struct=struct, key=string, indicateNotExisting=boolean );
Returns: Boolean
| Argument | Description |
|---|---|
|
struct
struct,
required
|
edit
Structure contains element to remove. Alias: structure, object |
|
key
string,
required
|
edit
Element to remove |
|
indicateNotExisting
boolean,
optional
|
edit
Alias: indicateExists |
Examples
editNon-Member Function
animals = {
cow: "moo",
pig: "oink",
cat: "meow"
};
// Show current animals
Dump(
label: "Current animals",
var: animals
);
// Delete the key 'cat' from struct
StructDelete(animals, "cat");
// Show animals, cat has been deleted
Dump(
label: "Animals with cat deleted",
var: animals
);
See also
- Structures
- struct.delete()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)