[Gambas-user] Re: Again on splitting

PV oreip at ...1...
Mon Jun 20 17:48:00 CEST 2005


Ok, I think I got it by looking at the split source code ;-)

However I believe the help text should sound like: "any separator characters 
contained in a string delimited by two escape characters are ignored in the 
splitting process".

Regards,
Piero

---

On 20/06/2005 13:05, PV wrote:
> Hi All,
> 
> from the help text about split: "Escape characters can be specified: any
> separator characters enclosed between two escape characters are ignored 
> in the
> splitting process".
> 
> So, if I understand correctly the meaning of the escape characters, one
> separator enclosed between two escape characters is ignored, that is 
> it's not
> seen as a separator but instead as a "regular" character, right?
> 
> But then, again if I understood well, there's something wrong with how 
> split
> works with the escape characters, because if I do something like
> 
>   DIM s AS String[]
>   DIM s1 AS String
> 
>   s = NEW String[](2)
> 
>   s1 = "ax xb"
>   s = Split(s1, " ", "x")
> 
>   print s[0]
>   print s[1]
> 
> I would expect that split shouldn't split at all because the " " separator
> character, enclosed between two "x" escape characters, should be ignored 
> as a
> separator and split return the entire string since it shouldn't detect any
> separator.
> 
> The above code instead returns "ax" as s[0] and "b" as s[1] so either 
> there's a
> bug in the split code or I don't understand correctly the meaning of the
> separator characters :-)
> 
> Regards,
> Piero
> 
> 




More information about the User mailing list