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.
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_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)
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."