StructFind

Finds and retrieves a top-level key from a string in a struct

Method Signature

StructFind(struct=[structloose], key=[any], defaultValue=[any])

Arguments

Argument
Type
Required
Description
Default

struct

struct

true

The struct object

key

any

true

The key to search

defaultValue

any

false

An optional value to be returned if the struct does not contain the key

Examples

Simple example

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

Run Example

countries = { 
	"USA" : "Washington D.C.",
	"Germany" : "Berlin",
	"Japan" : "Tokio"
};
writeOutput( structFind( countries, "Germany" ) );

Result: Berlin

Additional Examples

Run Example

Last updated

Was this helpful?