[Gambas-bugtracker] Bug #2107: Split() looses " in some cases

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Sun Feb 28 03:05:41 CET 2021


Comment #2 by Benoît MINISINI:

No, this is the expected behaviour.

When an escape character is read (a double quote in your example), everything is read until the next escape character to form a splitted element, EXCEPT if two successive escape characters are encountered. In that case, the two successive escape characters are replaced by one, and the process continue until the next single escape character.

This is the way escape characters are quoted for Split().

In other words:

Split("a 'b ''c' 'd' 'e'", " ", "'", False, True) returns ["a", "'b 'c'", "'d'", "'e'"]

More information about the Bugtracker mailing list