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

Bruce Steers bsteers4 at gmail.com
Thu Nov 23 18:19:51 CET 2023


On Thu, 23 Nov 2023 at 16:55, T Lee Davidson <t.lee.davidson at gmail.com>
wrote:

>
> Public Sub Squash() As String[]
>
>    Return Split(Super.Join(","), ",", Null, True) ' I like that code,
> Guianluigi; very slick.
>
> End
>

That's not going to work if any strings have a comma in them though.


Public Sub Squash()

  For c as Integer = Me.Max DownTo 0
    If Not Me[c] Then Me.Remove(c)
  Next

End

Public Sub Squashed() As String[]
Dim aStr As New String[]
  For c as Integer 0 To Me.Max
    If Me[c] Then aStr.Add(Me[c])
  Next

  Return aStr

End

Respects
BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20231123/3628a6e4/attachment.htm>


More information about the User mailing list