Intel® Fortran Compiler 18.0 Developer Guide and Reference

VERIFY

Elemental Intrinsic Function (Generic): Verifies that a set of characters contains all the characters in a string by identifying the first character in the string that is not in the set.

result = VERIFY (string, set [, back] [, kind])

string

(Input) Must be of type character.

set

(Input) Must be of type character with the same kind parameter as string.

back

(Input; optional) Must be of type logical.

kind

(Input; optional) Must be a scalar integer constant expression.

Results

The result type is integer. If kind is present, the kind parameter of the result is that specified by kind; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined.

If back is omitted (or is present with the value false) and string has 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 the value true and string has 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.

If each character of string is in set or the length of string is zero, the value of the result is zero.

The setting of compiler options specifying integer size can affect this function.

Example

VERIFY ('CDDDC', 'C') has the value 2.

VERIFY ('CDDDC', 'C', BACK=.TRUE.) has the value 4.

VERIFY ('CDDDC', 'CD') has the value zero.

The following shows another example:

 INTEGER(4) position

 position = VERIFY ('banana', 'nbc')  ! returns 2
 position = VERIFY ('banana', 'nbc', BACK=.TRUE.)
                                      ! returns 6
 position = VERIFY ('banana', 'nbca') ! returns 0

See Also