[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: |
Sat, 30 Mar 2013 11:50:36 -0400 |
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().
scripts/deprecated/javafields.m
scripts/deprecated/javamethods.m
scripts/general/fieldnames.m
scripts/general/int2str.m
scripts/general/methods.m
scripts/general/num2str.m
scripts/help/gen_doc_cache.m
scripts/help/help.m
scripts/help/lookfor.m
scripts/io/strread.m
scripts/java/javaclasspath.m
scripts/miscellaneous/compare_versions.m
scripts/miscellaneous/computer.m
scripts/miscellaneous/fact.m
scripts/miscellaneous/tar.m
scripts/miscellaneous/unpack.m
scripts/miscellaneous/what.m
scripts/miscellaneous/zip.m
scripts/pkg/private/configure_make.m
scripts/pkg/private/fix_depends.m
scripts/pkg/private/generate_lookfor_cache.m
scripts/pkg/private/list_forge_packages.m
scripts/pkg/private/unload_packages.m
scripts/pkg/private/write_index.m
scripts/plot/private/__file_filter__.m
scripts/plot/private/__fltk_file_filter__.m
scripts/plot/private/__go_draw_axes__.m
scripts/plot/private/__next_line_style__.m
scripts/strings/strsplit.m
scripts/strings/untabify.m
scripts/testfun/rundemos.m
scripts/testfun/runtests.m
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.
The threee major impacts are;
(1) Delimiters are now string vectors, not scalars.
Old behavior
strsplit ("1 2, 3", ", ")
ans =
{
[1,1] = 1
[1,2] = 2
[1,3] =
[1,4] = 3
}
New (compatible) behavior
strsplit ("1 2, 3", ", ")
ans =
{
[1,1] = 1 2
[1,2] = 3
}
(2) The Matlab default is to treat consecutive delimiters are treated as a
single delimiter. The old Octave default was the opposite.
(3) The old behavior supporting 2D character arrays is gone (only vectors now).
Comments?
Ben
changeset.patch
Description: Binary data
- strsplit needs an update, Jordi Gutiérrez Hermoso, 2013/03/27
- Re: strsplit needs an update,
Ben Abbott <=
- 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
- Re: strsplit needs an update, Ben Abbott, 2013/03/31