SCAN — Scan a string for the presence of a set of characters#
-
SCAN(STRING, SET, BACK, KIND)#
Scans a
STRING
for any of the characters in aSET
of characters.- Parameters:
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.
- Returns:
The return value is of type
INTEGER
and of kindKIND
. IfKIND
is absent, the return value is of default integer kind.
- Standard:
Fortran 90 and later, with
KIND
argument Fortran 2003 and later- Class:
Elemental function
- Syntax:
RESULT = SCAN(STRING, SET[, BACK [, KIND]])
- Example:
PROGRAM test_scan WRITE(*,*) SCAN("FORTRAN", "AO") ! 2, found 'O' WRITE(*,*) SCAN("FORTRAN", "AO", .TRUE.) ! 6, found 'A' WRITE(*,*) SCAN("FORTRAN", "C++") ! 0, found none END PROGRAM
- See also:
INDEX — Position of a substring within a string, VERIFY — Scan a string for characters not a given set