help-octave
[Top][All Lists]
Advanced

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

Re: strmatch question


From: James Sherman Jr.
Subject: Re: strmatch question
Date: Mon, 30 Jan 2012 16:18:30 -0500

On Mon, Jan 30, 2012 at 3:34 PM, seektime <address@hidden> wrote:
Hi All,

I'm wondering about the output of "strmatch". (windows installer, mingw,
Octave ver. 3.4.3)

While this is as described in the manual:

> strmatch('apple', 'apple juice')
ans = 1


this is somewhat unexpected:

> strmatch('juice', 'apple juice')
ans = [](0x0)

Shouldn't it be "7"?

Thanks,
Michael


From the second example in the help file for strmatch:

          strmatch ("apple", ["apple pie"; "apple juice"; "an apple"])
               => [1; 2]

Your first case is like "apple pie" or "apple juice", the third case is like the third example.  It must match only up to the length of the string, unless a third argument of "exact" is given.

It sounds like you're describing the behavior of strfind rather than strmatch.

Hope this helps,

James Sherman
 

reply via email to

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