[Gambas-user] Split Function ???

Charlie Ogier charlie at cogier.com
Tue Jan 12 14:21:26 CET 2021


Hi Olivier,

Try this: -

'****************************
Public Sub Form_Open()

   Dim s As String = "Test - test2 - test3 test4"
   Dim sArray As String[] = Split(s, "-") 'NOT " - "
   Dim iLoop As Integer

   For iLoop = 0 To sArray.Max
     Print Trim(sArray[iLoop])
   Next

End
'****************************

Charlie

On 12/01/2021 13:03, Olivier Coquet 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/f816241b/attachment.htm>


More information about the User mailing list