Ok, thank you, Tobi.
I'll have to start thinking again (but not tonight anymore).
Matti

Am 22.05.2017 um 22:17 schrieb Tobias Boege:
> On Mon, 22 May 2017, Matti wrote:
>> If I have a string sStr="hello##12345" and want to split it:
>>
>> Dim aSplit as String[]
>> aSplit = Split(sStr, "##")
>> Print aSplit[0], aSplit[1]
>>
>> Returns always only "hello". Maybe "12345" is excluded because being an 
>> integer?
>>
> It is not an integer in this case. It's a string of characters and Split()
> doesn't interpret it as an integer. Consequently it has nothing to do with
> IgnoreVoid in my book.
>
> If anything is wrong, it is your use of the separator. According to the
> documentation (and the implementation!), the Separator argument is a *list*
> of separator characters, i.e. "##" will not split against the string "##",
> but it will split against "#" or "#".
>
> To give a different example, if you had given the string "abc#123,456" and
> separators "#," you would have gotten the array ["abc", "123", "456"].
>
>> Now the Wiki says "StringArray = Split ( String [ , Separators , Escape , 
>> IgnoreVoid , KeepEscape ] )"
>> Where "IgnoreVoid" means "a boolean that tells Split() *not* to return void 
>> elements."
>>
>> By trial and error I found out that "IgnoreVoid" has to be set to 'True' to 
>> return "12345". Exactly the opposite.
>>
>> The Wiki should be corrected here.
>>
> I don't know what's the problem with your installation but on mine I get:
>
>    $ gbx3 -e 'Split("hello##12345", "##").Join("|")'
>    hello||12345
>
> i.e. it works. Notice the empty string between "hello" and "12345"
> in the context of what I explained about the separators above!
>
> Regards,
> Tobi
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to