[Gambas-user] Again on splitting

PV oreip at ...1...
Mon Jun 20 13:05:53 CEST 2005


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