[Gambas-user] How to extend the String[] class ??
Bruce Steers
bsteers4 at gmail.com
Thu Nov 23 23:47:38 CET 2023
On Thu, 23 Nov 2023, 21:58 T Lee Davidson, <t.lee.davidson at gmail.com> wrote:
> On 11/23/23 12:19, Bruce Steers wrote:
> >
> >
> > On Thu, 23 Nov 2023 at 16:55, T Lee Davidson <t.lee.davidson at gmail.com
> <mailto: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.
>
> That's true. I suppose one could use a demarcation character that is
> highly unlikely to be in a string:
>
> Return Split(Super.Join(Chr(31)), Chr(31), Null, True)
> or,
> Return Split(Super.Join(Chr(0)), Chr(0), Null, True)
>
Jolly good idea. 😊
For the OPs question though I would have to ask. Why does the list have
null strings to begin with?
Was it created using Split() ? and if yes do they know of the option to
remove null strings?
Or if created another way would it not be better to not add null strings to
begin with?
Although it was a good question and good to learn object arrays can be
inherited 😎
Respects
BruceS
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20231123/98de210d/attachment.htm>
More information about the User
mailing list