Verifies that all the characters in string
belong to the set of characters in set
.
If back
is either absent or equals false
, this function returns the position of the leftmost character of string
that is not in set
. If back
equals true
, the rightmost position is returned. If all characters of string
are found in set
, the result is zero.
Fortran 95 and later, with kind
argument Fortran 2003 and later
Elemental function
result = verify(string, set[, back [, kind]])
string
- Shall be of type character
.set
- Shall be of type character
.back
- (Optional) shall be of type logical
.kind
- (Optional) An integer
initialization expression indicating the kind parameter of the result.The return value is of type integer
and of kind kind
. If kind
is absent, the return value is of default integer kind.
program test_verify
write(*,*) verify("fortran", "ao") ! 1, found 'f'
write(*,*) verify("fortran", "foo") ! 3, found 'r'
write(*,*) verify("fortran", "c++") ! 1, found 'f'
write(*,*) verify("fortran", "c++", .true.) ! 7, found 'n'
write(*,*) verify("fortran", "fortran") ! 0' found none
end program