[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
New strsplit function
From: |
John W. Eaton |
Subject: |
New strsplit function |
Date: |
Thu, 16 May 2013 01:39:54 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.11) Gecko/20121122 Icedove/10.0.11 |
I received a report that the new strsplit function doesn't match
Matlab behavior for the following input. I looked at fixing it, but
I'm afraid I'll screw something else up because of the fairly complex
interactions among all the different options (legacy,
collapsedelimiters, etc.). Here's the simple test case:
With Matlab 2013a:
>> sgeQueryStr = '::'
sgeQueryStr =
::
>> splitStr = strsplit(deblank(sgeQueryStr), ':')
splitStr =
'' ''
>> length(splitStr)
ans =
2
So, what's the proper fix?
Also, I think that Matlab is saying that a delimiter at the beginning
of a string generates an empty result, but one at the end does not.
Before the recent changes to strsplit, Octave would return three empty
strings for this case. So should we consider that a bug in Octave?
If not, how do we preserve old behavior and also get Matlab
compatibility right in this case?
If we can't do both, maybe we should just abandon the "legacy"
behavior in our current strsplit function? If we do that, I suppose
we could distribute the old version as ostrsplit for a release or two.
jwe
- New strsplit function,
John W. Eaton <=