[Gambas-devel] gb3 Split() problem

Benoît Minisini gambas at ...1...
Mon Jan 4 14:21:04 CET 2010


> 2010/1/4 Benoît Minisini <gambas at ...1...>:
> >> 2010/1/4 Benoît Minisini <gambas at ...1...>:
> >> > Yes, I have added an explicit warning to the Split documentation, as
> >> > apparently it was not clear enough.
> >>
> >> Ok, I don't have an issue with that because I can deal with it, but
> >> about this...
> >>
> >> StringArray = Split ( String AS String [ , Separators AS String ,
> >> Escape AS String , IgnoreVoid AS Boolean , KeepEscape AS Boolean ] )
> >>
> >> I will change "Separators AS String" to "Separator AS String", in
> >> accordance with what the UI actually says.b
> >>
> >> I will also fix this, which uses two characters:
> >>
> >> Elt = Split(" Gambas Almost Means BASIC  !\n'Do you agree ?'", " \n",
> >> "'")
> >>
> >> " \n" is wrong.
> >
> > No, you can have several different separators. Each character in the
> > "Separators" is a possible separator. This is the reason why Separator is
> > written in the plural.
> 
> I'm sorry, Benoit, but if you if you allow more than one character as
> a separator then the failure to correctly deal with "\r\n" looks like
> a bug to me.
> 
> I'm not trying to be difficult here, but really, "\r\n" is just as
> much a sequence of ASCII characters as is "aZ". And by what you just
> said, "||" should result in a clean split without voids, but it most
> certainly does not. Look at the attached code. If the text uses "||"
> as the separator then the Split function returns voids for the second
> bar. The separator is singular, no two ways about it.
> 
> To put it another way, again without being rude, your answer does not
> match the facts.
> 
> >> I will also simplify the example:
> >>
> >> Elt = Split(" Gambas Almost Means BASIC  !\n'Do you agree ?'", " \n",
> >> "'")
> >>
> >> The control characters, question marks. and exclamation marks make it
> >> extremely difficult to immediately understand that the separator is
> >> singular.
> >>
> >> Are you ok with that?
> >>
> >> Regards,
> >
> > You can add simpler examples, but do not remove the complex ones, are
> > AFAIK, they are correct.
> 
> IMO, not a single one of the examples are correct based on the facts.
> Anyway, we still have issues to sort out before I get to changing the
> documentation, squire :)
> 
> Regards,
> 

Did you try the examples? They work as expected. What "facts" are you talking 
about? The fact are the results returned by the intepreter, and they perfectly 
match the examples. The examples are right.

Split(xxx, "\r\n") does not mean that you will split the string between the 
"\r\n" sequence, but that either "\r" or "\n" can be a separator.

Maybe it is just a misunderstanding based on the fact that English is not my 
native language and is not as precise as French?

AFAIK, you are the first one that does not understand the Split documentation, 
so until that, I thought it was perfectly clear.

I am against replacing "Separators" by "Separator", because using the plural 
form is less ambiguous. It shows that there is something special in the 
argument.

Regards,

-- 
Benoît Minisini




More information about the Devel mailing list