Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is IstringMap interface the best to find a string in a list?
#14
Macro Macro1996
Code:
Copy      Help
out

;create list of random strings for testing
str sList sFind
rep 1000
,sFind.RandomString(10 10 "a-z")
,sList.addline(sFind)
;out sList

;create map. Add indices now. Time 1100 us.
IStringMap m=CreateStringMap(1|2)
int i=1; str s
foreach(s sList) m.IntAdd(s i); i+1

;find string and get its index. Time 2 us.
if(!m.IntGet(sFind i)) i=0
out i


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)