[Gambas-user] Split Function ???

Jussi Lahtinen jussi.lahtinen at gmail.com
Tue Jan 12 21:52:53 CET 2021


Yet another solution:

Dim sArr As String[] = Split("Test - test2 - test3 test4", "-")
For ii As Integer = 0 To sArr.Max
  sArr[ii] = Trim(sArr[ii])
Next

I wish Gambas had Map function... Benoit?
So that we could write this as:

Dim sArr As String[] = Split("Test - test2 - test3 test4", "-")
sArr.Map(Trim)

Or:

Map(sArr, Trim)


Jussi

On Tue, Jan 12, 2021 at 3:05 PM Olivier Coquet <ocoquet at 3d-phenomen.fr>
wrote:

> Hi all,
>
> I have a problem with Split function.
>
> If I have a string like this:
>
> *"Test - test2 - test3 test4"*
>
> and I split with *" - "* separation string, I obtain
>
> *"Test" "test2" "test3" "test4"*
>
> and I want:
>
> *"Test" "test2" "test3 test4"*
>
> How can I make this ?
>
>
> regards
>
> Olivier
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210112/6010682c/attachment.htm>


More information about the User mailing list