[Gambas-user] How to extend the String[] class ??

Gianluigi gradobag at gradobag.it
Thu Nov 23 11:23:11 CET 2023


Il 23/11/23 10:58, Martín ha scritto:
> Hi,
>
> I wan to extend the String[] class, I wan to add a method to remove 
> all the strings where its length = 0
>
> I have this:
>
> aRecipes["Risotto", "", "Pascualina", "Focaccia"]
>
> I want this:
>
> aRecipes["Risotto",  "Pascualina", "Focaccia"]
>
> I wan to add to the method class in order to use like .Sort Metod.
>
> aRecipes = aRecipes.Vaccum( False )
>
> Regards.
>
> Martin.
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----

Hi Martin

Something like that?:

Public Sub Main()

   Dim aRecipes As String[] = ["risotto", "", "Pascualina", "focaccia"]
   Dim s As String

   s = aRecipes.Join(",")
   aRecipes.Clear
   aRecipes = Split(s, ",", Null, True)
   For Each s In aRecipes
     Print s
   Next

End

Regards

Gianluigi




More information about the User mailing list