ISASKEY Function
Matches a key name in a given associative array.
Usage
result = ISASKEY(asarr, key)
Input Parameters
asarr—The name of an associative array.
key—A string to be matched against the key names in the given associative array.
Returned Value
result—A value indicating success or failure of the match.
-
< 0—Indicates the string matches the key name in the associative array.
-
0—Indicates no match is found.
Keywords
None.
Discussion
Use this function to determine if a particular key name exists in a given associative array. A key name is the name associated with an element in the associative array. To create an associative array, use the ASARR function.
Example
ISASKEY is used to determine if the associative array contains the element named struct. If it does, then the value of struct is replaced with zero. The INFO command is used to verify the change.
asar1 = ASARR('byte', 1B, 'float', 2.2, 'string', '3.3', $ 'struct', {,a:1, b:LINDGEN(2)}) IF ISASKEY(asar1, 'struct') THEN asar1('struct') = 0 INFO, asar1, /Full ; PV-WAVE prints: ; ASAR1 AS. ARR = Associative Array(4) ; byte BYTE = 1 ; struct INT = 0 ; float FLOAT = 2.20000 ; string STRING = '3.3'