FreeMat: STRSTR String Search Function

FreeMat

- Main Page
- Related Pages

STRSTR String Search Function

Section: String Functions

# Usage

Searches for the first occurance of one string inside another. The general syntax for its use is

       p = strstr(x,y)

where `x` and `y` are two strings. The returned integer `p` indicates the index into the string `x` where the substring `y` occurs. If no instance of `y` is found, then `p` is set to zero.

# Example

Some examples of `strstr` in action

    --> strstr('hello','lo')

    ans =
     4

    --> strstr('quick brown fox','own')

    ans =
     9

    --> strstr('free stuff','lunch')

    ans =
     0