[Gambas-user] Make String class friendlier

Martin mbelmonte at belmotek.net
Wed Apr 7 17:11:59 CEST 2021


ok, I do not know the scope that something like this can have in the 
performance of the interpreter, but I leave an example of an independent 
class that works in the way I say except that it must be defined as "AS New"

in some form...

'------------------------------------------------------------------------

Public Sub Form_Open()

   Dim text As New Chain

   text.Text = "gambas"

   Print text.Text
   Print text.ToUpper

End

'------------------------------------------------------------------------

... then the class

'------------------------------------------------------------------------
Export

Private textValue As String

Property Read ToUpper As String

Property Text As String

Private Sub Text_Write(Value As String)

   textValue = Value

End

Private Function ToUpper_Read() As String

   Return Upper(TextValue)

End

Private Function Text_Read() As String

   Return TextValue

End

'------------------------------------------------------------------------

Regards

El 7/4/21 a las 13:03, Benoît Minisini escribió:
> Le 07/04/2021 à 10:51, Martin a écrit :
>> Hi.
>>
>> It would be interesting that in gambas we could operate the text 
>> strings as in javascript, don't you think? that is, it will access 
>> all the methods and properties of a chain using the dot operator and 
>> not only to .Len property.
>>
>> it's just a suggestion
>>
>> Regards.
>>
>> Martin.
>>
>
> I stopped at .Len(), because making String a pseudo-object needs 
> support for the interpreter, and it makes things slower. But that was 
> the idea.
>
> Regards,
>


More information about the User mailing list