octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: strsplit needs an update


From: Ben Abbott
Subject: Re: strsplit needs an update
Date: Sun, 31 Mar 2013 09:05:56 -0400

On Mar 31, 2013, at 7:53 AM, Carnë Draug wrote:

> On 30 March 2013 15:50, Ben Abbott <address@hidden> wrote:
> 
>> On Mar 27, 2013, at 12:50 PM, Jordi Gutiérrez Hermoso wrote:
>> 
>>> So this is why it's always an annoyance to try to implement something
>>> before Matlab... We've had strsplit since 2009 in Octave, and in 2013,
>>> TMW finally implements it themselves, with a differing calling form
>>> than ours:
>>> 
>>>   http://www.mathworks.com/help/matlab/ref/strsplit.html
>>> 
>>> Anyone feel like chasing after this?
>>> 
>>> - Jordi G. H.
>> 
>> I've prepared a version that is compatible with Matlab, but compatibility 
>> means that the current behavior must be broken.  There are many files which 
>> rely upon strsplit().
>> 
>> [...]
>> 
>> I've modified the files to use the new version, and produced a changeset.  I 
>> don't see any regressions, but this may break some code on Octave-Forge.
> 
> It does. There's a couple of functions in OF that use strsplit. The
> problem would be matching a new release of Octave and packages that
> make use of it.
> 
> Is anyone interested in contacting Mathworks to propose formation of
> some sort of consortium to avoid this sort of things in the future? :p
> 
> Carnë

In addition to Mathwork's new strsplit(), they have introduced strjoin().

        http://www.mathworks.com/help/matlab/ref/strjoin.html

Once strjoin() is added the compatible version may be used to obtain the 
conventional behavior by ...

        cstrsplit = @(str,del, collapsedelimiters=false) strsplit (strjoin 
(cellstr (str), del(1)), num2cell (del(:)), collapsedelimiters)

The strjoin() function is also a problem for OF.

        http://octave.sourceforge.net/strings/function/strjoin.html

However, the OF implementation does provide a good starting point for 
implementing strjoin() for Octave's core.

Ben



reply via email to

[Prev in Thread] Current Thread [Next in Thread]