Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
search array for dupes add item if not found
#2
Function ARRAY_str_AddUnique
Code:
Copy      Help
;/
function# ARRAY(str)&a $s [flags] ;;flags: 1 case insensitive

;Adds string s to array a. Does not add if a already contains the string.
;Returns index of found or new element.


int i ci(flags&1)
for i 0 a.len
,if(!StrCompare(a[i] s ci)) ret i
a[]=s
ret a.ubound


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)