[Gambas-user] Remove Null or Empty items in arrays.

Martín mbelmonte at belmotek.net
Wed Jun 21 18:37:57 CEST 2023


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.



More information about the User mailing list