Silverfrost Logo About Us | Contact Us
 

SCAN

Platform

x64, Win32, .NET

Purpose

To scan a string for any one of the characters in a set of characters.

Class

Elemental function.

Syntax

INTEGER FUNCTION SCAN(STRING, SET [, BACK])
CHARACTER (LEN=*) STRING, SET
LOGICAL BACK

Description

If BACK is omitted, this function scans STRING for the first occurrence of any of the characters in SET. If BACK is set to true, scanning starts at the end of STRING.

Return value

If a match is found, the result is an integer marking the position of the character in STRING starting at 1. If a match is not found or the length of STRING or SET is zero, the result is zero.

Example

SCAN ('FORTRAN', 'TR') has the value 3.

SCAN ('FORTRAN', 'TR', BACK = .TRUE.) has the value 5.

 

 

Copyright © 1999-2017 Silverfrost Limited