MapKeysGet

Returns all the keys of a WIL map's key-value pairs

Syntax:

MapKeysGet(map, return-type [, delimiter])

Parameters:

(m) map: a variable containing a WIL map.

(n) return-type: type of collection returned: 1 for an array and 2 for a delimited list.

(s) delimiter: [optional] single character delimiter. Only used when an delimited list is returned. (defaults to a tab character(@Tab)).

Returns:

(a/s)  an array or list of a map's keys.

 

The MapKeysGet function returns either an array or a delimited list of  all of the keys of the key-value pairs stored in a WIL map .

The second parameter controls the type of collection the function returns.  Place a one (1) in the parameter to obtain a one-dimension array with each element holding one of the keys stored in the WIL map or place a two (2) in the parameter to obtain a delimited list of keys stored in the WIL map.

Use the third parameter to optionally change the delimiter used to separate key names when you request that the function return a delimited list. The specified delimiter must be a single character.

Note: The delimiter parameter is optional and has no effect when an array return is requested. When an delimited list return type is requested and the delimiter parameter is not supplied, the function defaults to a tab character (@Tab) as the delimiter.

Example:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Get a list of WIL map keys
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Add 4 fruit names.
Pairs = 'Apples,0':@tab:'Oranges,0':@tab:'Pears,0':@tab:'Oranges,0'
Fruit = MapCreate(Pairs)
FruitList = MapKeysGet(Fruit, 2)
NumFruit = ItemCount(FruitList, @tab)
Message("Fruit Map Keys", "Keys are unique so the list will have " :NumFruit: " names")
See Also:

MapCreate, MapKeyExist, MapKeyRemove, MapFileGetCsv, MapFilePutCsv, MapValuesGet, MapKeyFind