CHR_FIND

Find the next occurrence of given substring within a string

Description:

Increments a pointer to a character position within the given string and checks if the following sequence of characters matches the specified substring, ignoring differences in case. The search may be performed either forwards or backwards. If a match is found, the position of the substring is returned. If no match exists, the pointer is set to one more than the length of the string if the search is forwards, zero if the search is backwards.

Invocation

CALL CHR_FIND( STRING, SUBSTR, FORWD, IPOSN )

Arguments

STRING = CHARACTER ( ) (Given)
The string to be searched.
SUBSTR = CHARACTER ( ) (Given)
The substring to be searched for, ignoring case.
FORWD = LOGICAL (Given)
The search direction: if .TRUE., proceed through the string in a forward direction, otherwise work backwards.
IPOSN = INTEGER (Given and Returned)
The starting position for the search. If the initial value of IPOSN does not point at a character within the string, the routine returns without action.