Determines the value associated with a key in a structure.
structFind(structure, key [, defaultValue ])
returns any
struct.find(key [, defaultValue ])
Name | Type | Required | Default | Description |
---|---|---|---|---|
structure | struct | Yes | Structure that contains the value to return | |
key | string | Yes | Key whose value to return | |
defaultValue | any | No | Lucee4.5+ Default value which will be returned if the key does not exist or if null was found. Currently only supported by Lucee. See https://docs.lucee.org/reference/functions/structfind.html#argument-defaultValue |
Searches through a structure by a given key and outputs the related value
countries = {
"USA"="Washington D.C.",
"Germany"="Berlin",
"Japan"="Tokio"
};
writeOutput(structFind(countries, "Germany"));