Login Register






[AutoIt]Remove all empty elements in an array filter_list
Author
Message
[AutoIt]Remove all empty elements in an array #1
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...
(This post was last modified: 11-26-2011, 07:39 AM by Skullmeat.)
Pierce the life fibers with your drill.

Reply

RE: [AutoIt]Remove all empty elements in an array #2
This is A Nice Substitute for ArrayDelete()

Reply

RE: [AutoIt]Remove all empty elements in an array #3
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
Pierce the life fibers with your drill.

Reply

RE: [AutoIt]Remove all empty elements in an array #4
(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.

Reply