SourcePoint Intel Help

Table of Contents

strstr

Search an ASCII string for the occurrence of a given sub-string.

Syntax

[result =] strstr(string-expr1, string-expr2)

Where:

result

specifies a debug object of type int4 to which the function return value is assigned. If result is not specified, the return value is displayed on the next line of the screen.

string-expr1

specifies an nstring variable or a quoted string constant.

string-expr2

specifies an nstring variable or a quoted string constant.

Discussion

A case-sensitive search is performed on string-expr1, looking for string-expr2. If string-expr2 is found within string-expr1, the index of the match is returned. ย A return value of -1 indicates that string-expr2 was not found.

Example 1

Command input:

define nstring string1 = "AaBbCcDdEeFf"
define nstring string2 = "Dd"
define int4 ret_val = strstr(string1, string2)
ret_val

Result:

6T

Example 2

Command input:

strstr(string1, "DD")

Result:

-1T

ย 

ย