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

BB adamnt42 at gmail.com
Thu Nov 23 13:24:07 CET 2023


On 23/11/23 10:35 pm, Martín wrote:
> El 23/11/23 a las 12:32, BB escribió:
>> I have not been successful trying the same. The native[] classes seem 
>> to be a bit different. 
>
> Exactly, the Class String[] seems to be different.
>
> I extend perfectly tha clas String using thismethod.
>
> I create a class names String.class in my project, then inside this i 
> put some code like the follow:
>
> ' Gambas class file
>
> Export
>
> Static Public Function Aleph(z As Integer) As String
>
>   Dim sWord As String
>   Dim r As Integer
>
>   For r = 1 To z
>     sWord &= Chr(Rand(65, 90))
>   Next
>
>   Return sWord
>
> End
>
> Then I get the new method "Aleph" in in the native class String. its 
> act the same that the class util.class  that extend String adding 
> RemoveDiacritics() method etc.
>
> But How to extend String[] is a mystery for me.
>
> Martín.
>
I think the thing[] classes descend from Array not the thing type, but 
trying to build an override also does not seem trivial.

b



More information about the User mailing list