MapKeysToString(), MapKeysToArray(), MapKeysToList()
Posted: Tue Sep 14, 2010 5:02 am
I know these functions are trivial, but I often need them in my programs. I've written my own procedures but I'm sure native commands would be faster. Plus, my procedures can only take one kind of map so there's a lot of duplication there.
#PB_MapKeys_Add - the map's keys would be added to the list or array (array would be redimmed to the needed size)
#PB_MapKeys_OnlyThese - the list/array would be emptied and the map's keys added to it (array would be dimmed to the needed size)
Code: Select all
stringarray.s = MapKeysToString(mp(),"|") ; the second parameter is a delimiter for the string array
NewList ls.s()
MapKeysToList(mp(),ls(),#PB_MapKeys_Add)
Dim arr.s(0)
MapKeysToArray(mp(),arr(),#PB_MapKeys_OnlyThese)
#PB_MapKeys_OnlyThese - the list/array would be emptied and the map's keys added to it (array would be dimmed to the needed size)