[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
split-string behavior change
From: |
Stephen J. Turnbull |
Subject: |
split-string behavior change |
Date: |
Mon, 25 Feb 2008 11:11:38 +0900 |
Drew Adams writes:
> I'm not suggesting we change anything now, but I'm curious about the change
> in behavior of split-string from Emacs 21 to 22.
split-string in Emacs 21 was unable to give appropriate results for
(split-string csv ",")
where CSV is in comma-separated values format, and has leading or
trailing empty fields. That turns out to be a moderately big deal,
because it is non-trivial to code this function efficiently and
correctly. (At least, that was the motivation I was told for XEmacs
not removing nulls at all. Apparently how to parse CSV correctly was
a FAQ in some circles.) Also, for several cases it gave different
results from XEmacs (including this case).
The current behavior is the result of a compromise which preserves the
magic behavior of removing empty fields in the one-argument case, uses
the simpler behavior of just splitting on the regexp always in the
two-argument case, and restores magic behavior in the three argument
case with a non-nil third argument.