SourcePoint Intel Help

Table of Contents

strchr

Find a character in a string.

Syntax

[result =] strchr(string, ch)

Where:

result

specifies an nstring 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 strchr function finds a character in a string. ย The return value is a substring containing the first instance of the character found, and the rest of the string following it. ย The return value can be assigned to an nstring variable, or displayed on the command line.

Example 1

Command input:

define nstring test = "123456"

strchr(test, '3')

Result:

3456

Example 2

Command input:

define nstring strAnswer = strchr("123456", '4')

strAnswer

Result:

456

Related Topics: