SourcePoint Intel Help

Table of Contents

strpos

Find a character in a string.

Syntax

[result = ] strpos(string, ch)

Where:

result

specifies an ord4 variable 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

is an nstring variable, or string constant, to search.

ch

is the character to search for.

Discussion

The strpos function finds a character in a string.ย  The return value is the index of the first instance of the character found.ย  The return value can be assigned to an ord4 variable, or displayed on the command line.

Example 1

Command input:

define nstring test = "123456"

strpos(test, '3')

Result:

2

Example 2

Command input:

define ord4 nIndex = strpos("123456", '4')

nIndex

Result:

3

Related Topics: