[Gambas-user] Remove Null or Empty items in arrays.
jussi.lahtinen at gmail.com
Wed Jun 21 18:46:16 CEST 2023
Almost always you can remove null or zero value when constructing the
array. This encourages bad habits.
On Wed, Jun 21, 2023 at 7:37 PM Martín <mbelmonte at belmotek.net> wrote:
> El 21/6/23 a las 13:08, Bruce Steers escribió:
> > Public Sub ArrayClean(MyArray As Variant) As Variant
> > Dim hArray As Variant = MyArray.Copy()
> > For c As Integer = hArray.Max DownTo 0
> > If Not hArray[c] Then hArray.Remove(c)
> > Next
> > Return hArray
> > End
> I like this code you propose, thank you.
> But I was wondering, since there is .Shuffle or .Sort, maybe it would be
> a good idea to have .RemoveEmpty.
> Best regards.
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the User