[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: |
Fri, 29 Mar 2013 08:25:10 -0400 |
On Mar 27, 2013, at 9:16 PM, Ben Abbott wrote:
> On Mar 27, 2013, at 2:19 PM, Jordi Gutiérrez Hermoso wrote:
>
>> On 27 March 2013 14:07, 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?
>>>
>>> Looks like a wrapper around regexp.
>>>
>>> [c, matches] = strsplit (str, delimiter, name, value)
>>>
>>> [c, matches] = regexp (str, delimiter, 'split', name, value);
>>>
>>> Any info on what "name", "value" pairs are supported?
>>
>> They list two options further down, "CollapsibleDelimiters" and
>> "DelimiterType". Looks like TMW is finally deciding to uniformise
>> passing options to all functions with this ersatz named parameter
>> method. I wonder if this means they'll kill optimset and odeset.
>>
>> - Jordi G. H.
>
> From reading the on-line docs, I think the examples below are proper
> behavior. Do you agree?
>
> strsplit ("road to^hell", " ^", "delimitertype", "simple")
> ans =
> {
> [1,1] = road
> [1,2] = to
> [1,3] = hell
> }
Matlab R2013a works differently.
strsplit ('road to^hell', ' ^', 'delimitertype', 'simple')
ans =
'road to^hell'
strsplit ('road to^hell', {' ', '^'}, 'delimitertype', 'simple')
ans =
'road' 'to' 'hell'
> strsplit ("road to hell", " ^", "delimitertype", "regularexperession")
> ans =
> {
> [1,1] = road to hell
> }
> strsplit ("road to hell", "[ ^]", "delimitertype", "regularexperession")
> ans =
> {
> [1,1] = road
> [1,2] = to
> [1,3] = hell
> }
Matlab's behavior is the the same as above for regular expressions.
Ben
- strsplit needs an update, Jordi Gutiérrez Hermoso, 2013/03/27
- Re: strsplit needs an update, Ben Abbott, 2013/03/30
- Re: strsplit needs an update, Carnë Draug, 2013/03/31
- Re: strsplit needs an update, Ben Abbott, 2013/03/31
- Re: core, matlab, & OF name conflicts [Was: strsplit needs an update], Ben Abbott, 2013/03/31
- Re: core, matlab, & OF name conflicts [Was: strsplit needs an update], Richard Crozier, 2013/03/31
- Re: core, matlab, & OF name conflicts [Was: strsplit needs an update], Ben Abbott, 2013/03/31
- Re: core, matlab, & OF name conflicts [Was: strsplit needs an update], John W. Eaton, 2013/03/31
- Re: core, matlab, & OF name conflicts [Was: strsplit needs an update], Richard Crozier, 2013/03/31
- Re: core, matlab, & OF name conflicts [Was: strsplit needs an update], John W. Eaton, 2013/03/31
- Re: core, matlab, & OF name conflicts [Was: strsplit needs an update], Carnë Draug, 2013/03/31