Determines the value associated with a key in a structure.

structFind(structure, key [, defaultValue ]) → returns any

Member Function Syntax

struct.find(key [, defaultValue ])

Argument Reference

structure struct

Structure that contains the value to return

key string

Key whose value to return

defaultValue any

Lucee 4.5+ Default value which will be returned if the key does not exist or if null was found. Currently only supported by Lucee. See

Sample code invoking the structFind function

Searches through a structure by a given key and outputs the related value

countries = {
    "USA"="Washington D.C.",
writeOutput(structFind(countries, "Germany"));

Expected Result: Berlin

Fork me on GitHub