Sinisterly
[AutoIt]Remove all empty elements in an array - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Coding (https://sinister.li/Forum-Coding--71)
+--- Thread: [AutoIt]Remove all empty elements in an array (/Thread-AutoIt-Remove-all-empty-elements-in-an-array)



[AutoIt]Remove all empty elements in an array - 1234hotmaster - 11-26-2011

Code:
; Removes Elemets that contain only whitespace characters and returns the new array. ; The count of the return is at $aRet[0]. Func _ArrayRemoveBlanks($aID) Local $sTmp = '' For $i = 0 to Ubound($aID) -1 If StringRegExpReplace($aID[$i], "\s", "") Then $sTmp &= $aID[$i] & Chr(0) Next Return StringSplit(StringTrimRight($sTmp, 1), Chr(0)) EndFunc

This code is not mine, credits go completely to smashly Smile
I thought i share this cause its awesome and doesn't use _ArrayDelete() like some other func I saw the other day...


RE: [AutoIt]Remove all empty elements in an array - ReaperX - 11-28-2011

This is A Nice Substitute for ArrayDelete()


RE: [AutoIt]Remove all empty elements in an array - 1234hotmaster - 11-29-2011

Actually ArrayDelete() is buggy because if you put ArrayDelete() in a loop the index will change and you will get a array out of dimension error Biggrin


RE: [AutoIt]Remove all empty elements in an array - ReaperX - 11-29-2011

(11-29-2011, 03:54 AM)[ntdll.dll]x[advapi32.dll] Wrote: Actually ArrayDelete() is buggy because if you put ArrayDelete() in a loop the index will change and you will get a array out of dimension error Biggrin

That Happened To Me.