[UP]


Manual Reference Pages  - scan (3)

NAME

scan(3f) - [FORTRAN:INTRINSIC:CHARACTER] Scan a string for the presence of a set of characters

CONTENTS

Syntax
Description
Arguments
Return Value
Example
Standard
Class
See Also

SYNTAX

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

DESCRIPTION

Scans a STRING for any of the characters in a SET of characters.

If BACK is either absent or equals FALSE, this function returns the position of the leftmost character of STRING that is in SET. If BACK equals TRUE, the rightmost position is returned. If no character of SET is found in STRING, the result is zero.

ARGUMENTS

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.

RETURN VALUE

The return value is of type INTEGER and of kind KIND. If KIND is absent, the return value is of default integer kind.

EXAMPLE

Sample program:

    program demo_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 demo_scan

STANDARD

[[Fortran 95]] and later, with KIND argument [[Fortran 2003]] and later

CLASS

[[Elemental procedure|Elemental function]]

SEE ALSO

Functions that perform operations on character strings, return lengths of arguments, and search for certain arguments:
Elemental:
  ADJUSTL, ADJUSTR, INDEX, LEN_TRIM, SCAN, VERIFY;
Nonelemental:
  REPEAT, TRIM


scan (3) March 19, 2019
Generated by manServer 1.08 from f2196065-1165-42d4-acdd-c363dbe5dc87 using man macros.