Datenshi Posted June 27, 2010 Share Posted June 27, 2010 (edited) Needed this so i put it together in 10min, someone might find it useful. If you're wondering what it does then read help for _ArrayFindAll. Basically returns an array of elements that contain a certain string. iPartial = 1 means $vValue of "hello", will match byehellobye. Default is 0 is exact match, "hello" matches only "hello". Func _ArrayLookup(Const ByRef $avArray, $vValue, $iStart = 0, $iEnd = 0,$iPartial = 0) ; Quickly searches an array for a specific value and return element if found. Local $iResSize = 0, $avSize = UBound($avArray) - 1 If $iStart > $avSize Then Return SetError(2) ; out of bound Dim $avResult[$avSize] If $iEnd <> 0 And $iEnd <= $avSize Then $avSize = $iEnd ; If End param is valid set it. For $iIndex = $iStart To $avSize Switch $iPartial Case 0 If StringInStr($avArray[$iIndex], $vValue) <> 0 Then ; allows partial match $avResult[$iResSize] = $iIndex $iResSize += 1 EndIf Case 1 If $avArray[$iIndex] = $vValue Then ; allows only exact match $avResult[$iResSize] = $iIndex $iResSize += 1 EndIf Next If $iResSize = 0 Then Return SetError(1) ; nothing found ReDim $avResult[$iResSize] Return $avResult EndFunc ;==>_ArrayLookup Edited June 30, 2010 by Datenshi RapidQueuer 2.4 - For Rapidshare.comOpensubtitles Hashing FuncRevision3 PlayerGTPlayer BetaIMDB & Poster Grabber v1.3Fetgrek.com - My Website Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now