[REBOL] Re: Find on a nested structure
From: koolauscott:yaho:o at: 11-Apr-2001 22:13
I've been doing the following with a similar problem:
MyStructure: [
["US" ["USA" "English" "Spanish"] ]
["DE" ["Germany" "German"] ]
["NZ" ["New Zealand" "English"] ]
]
search: func [search-term [string!]][
foreach item MyStructure [
if find first item search-term [
return second item
]
]
]
Example:
>> search "NZ"
== ["New Zealand" "English"]
>> search "DE"
== ["Germany" "German"]
I hope this is what you were asking for.
--- [Sanghabum--aol--com] wrote: