strncmp: bug comparing two character arrays
Thorsten Meyer
thorsten.meyier at gmx.de
Thu Jan 1 14:46:16 CST 2009
Hi,
Ben Abbott wrote:
> This appears to be compatible behavior.
>
> >> strncmp(['ab';'cd'], ['ab';'ce'], 2)
>
> ans = 1
>
> >> strncmp(['ab';'cd'], ['ab';'ce'], 3)
>
> ans = 1
>
> >> strncmp(['ab';'cd'], ['ab';'ce'], 4)
>
> ans = 0
yes, you are right. Googling the matlab documentation I even found an
example for this:
http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/strncmpi.html&http://www.google.de/search?hl=de&as_qdr=all&q=matlab+site%3Awww.mathworks.com+strncmp&btnG=Suche&meta=
So it is intended behaviour as well.
Thanks for crosschecking.
Thorsten
More information about the Bug-octave
mailing list