[Pkg-octave-devel] Bug#603046: Bug#603046: Bug#603046: octave3.2: strchr triggers Octave:str-to-num

Kim Hansen kim at i9.dk
Wed Nov 17 08:59:37 UTC 2010


On Wed, Nov 17, 2010 at 07:42, John W. Eaton <jwe at octave.org> wrote:
> On 16-Nov-2010, Thomas Weber wrote:
>
> | > strchr treats a string as a number implicitly:
> | >
> | > kim at raph:~/orion/svn/raph1/octave$ octave
> | > GNU Octave, version 3.2.4
> | > ....
> | > octave:1> warning error Octave:str-to-num
> | > octave:2> strchr("Octave is the best software","best")
> | > error: implicit conversion from string to real N-d array
>
> I don't see an error with the current development sources, so I think
> this problem has already been fixed.

I just checked the trunk version, it has some performance
optimizations that means the old code is not used unless arg 2 is
longer than 6.

octave:2> warning error Octave:str-to-num
octave:3> strchr("Octave is the best software","best")
ans =

    3    6    9   11   13   15   16   17   18   20   23   27

octave:4> strchr("Octave is the best software","software")
error: implicit conversion from string to real N-d array
error: type conversion failed for binary operator `+'
error: evaluating argument list element number 1
error: invalid empty index list
error: called from:
error:   /home/kim/octave/install-trunk/share/octave/3.3.53+/m/strings/strchr.m
at line 50, column 18
octave:4>

-- 
Kim Hansen
Vadgårdsvej 3, 2.tv
2860 Søborg
Phone: +45 3091 2437





More information about the Pkg-octave-devel mailing list