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

BB adamnt42 at gmail.com
Thu Nov 23 12:32:50 CET 2023


On 23/11/23 8:53 pm, Gianluigi wrote:

> 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
>
Yes that will work but it doesn't extend the String[] class.

I have not been successful trying the same. The native[] classes seem to 
be a bit different.

b



More information about the User mailing list