verify

Date:

06-19-2023

NAME

VERIFY - Verifies that a set of characters contains all characters in a string

SYNOPSIS

INTEGER result, kind
CHARACTER string, set
LOGICAL back

result = VERIFY ([STRING=]string, [SET=]set [, [BACK=]back, [KIND=]kind])

STANDARDS

Fortran

DESCRIPTION

The VERIFY intrinsic function verifies that a set of characters contains all characters in a string by identifying the first character position in a string of characters that does not appear in a given set of characters. VERIFY accepts the following arguments:

string

Must be of type character variable.

set

Must be of type character variable, expression, or constant.

back

Must be of type logical. If back is omitted, a value of false is assumed.

kind

Determines the kind type parameter of the return result. This argument must be a scalar integer initialization expression. See the RETURN VALUES section for more information.

VERIFY is an elemental function. The name of this intrinsic cannot be passed as an argument.

RETURN VALUES

The result is of type INTEGER and its kind type parameter is dependent on the kind argument. If the kind argument is not passed, the kind type parameter of result is the same as that of the default integer type; otherwise it is of the kind type parameter specified by the kind argument.

The result is an integer.

If back is absent or is present with a value FALSE and string contains at least one character that is not in set, the value of the result is the position of the leftmost character of string that is not in set.

If back is present with a value TRUE and if string contains at least one character that is not in set, the value of the result is the position of the rightmost character of string that is not in set.

VERIFY returns 0 if each character in string is in set, or if the length of string is 0.

EXAMPLES

VERIFY(‘ABBA’,’A’) yields 2.

VERIFY(‘ABBA’,’A’,BACK=.TRUE., KIND=4) yields 3.

VERIFY(‘ABBA’,’AB’) yields 0.