octave-maintainers
[Top][All Lists]
Advanced

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

Re: new strsplit function


From: Philip Nienhuis
Subject: Re: new strsplit function
Date: Sat, 20 Apr 2013 23:41:18 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11) Gecko/20100701 SeaMonkey/2.0.6

Ben Abbott wrote:
On Apr 20, 2013, at 3:51 PM, Philip Nienhuis wrote:

Ben Abbott wrote:
On Apr 2, 2013, at 11:42 PM, John W. Eaton wrote:
:
<snip>
:
Also, the new strsplit does not seem to be working correctly for single-quoted 
strings that contain escape sequences.  I think that

strsplit ("foo\tbar", '\t')

should split on the TAB, but it is currently returning the original string for 
me.

Opps.  I hadn't considered single quoted strings.  Your example does work in 
Matlab.  How is this sort of thing handled in other places?  It is sufficient 
to just ...

<snip>

And then there is the bug John mentioned with escape characters.
On a stable MinGW 3.6.4 build it doesn't work either:

octave:1>  strsplit ("foo\tbar", '\t')
ans =
{
  [1,1] = foo   bar
}

Is this with the changeset I attached applied?

Sorry I got a but confused, didn't pick up that your "sq" cs was for that very issue.

I applied it manually to yesterday's MXE-build (from yesterday's updated source tree) and now it works correctly:

octave-cli:1> test strsplit
PASSES 38 out of 38 tests
octave-cli:2> strsplit ("foo\tbar", '\t')
ans =
{
  [1,1] = foo
  [1,2] = bar
}
octave-cli:3>


Anyway, in view of JWE's comments, what is going to happen now with strsplit.m? Do we keep the changes and the "legacy" option, or do we simply follow ML as John suggested?

As long as speed isn't affected (-significantly) for simple cases I don't care very much.
You have already patched the affected core functions.
In the io package (spreadsheet functions) there are only "simple" calls to strsplit (i.e. with just a one-char delimiter) so am I right to assume no changes are required there?

BTW in the texinfo help of strsplit there's neither an (explicit) explanation of what the 'simple' DELIMITERTYPE does, nor an example.

Philip


reply via email to

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