If you're set's small you could get away with something like this though it's not efficient but it might also work in spider basic.
Code: Select all
Procedure EnumMap(Map mp(),List ls.s(),key.s,len,mode=#PB_Unicode)
Protected word.s
ForEach mp()
word = PeekS(mp(),-1,mode)
If Left(word,len) = key
AddElement(ls())
ls() = word
EndIf
Next
SortList(ls(),#PB_Sort_Ascending)
EndProcedure
NewMap txt.i()
NewList out.s()
AddMapElement(txt(),"ab") : txt()=@"ab"
AddMapElement(txt(),"abc") : txt()=@"abc"
AddMapElement(txt(),"abcd") : txt()=@"abcd"
AddMapElement(txt(),"cdef") : txt()=@"cdef"
EnumMap(txt(),out(),"ab",2)
ForEach out()
Debug out()
Next
ClearList(out())
EnumMap(txt(),out(),"cd",2)
ForEach out()
Debug out()
Next
ClearList(out())