9.3.134 SCAN (STRING, SET [,BACK])

Description:  Scans a string for any character in a set of characters.  
Class:  Elemental function; Generic 
Arguments:  STRING Must be of type character.  
  SET Must be of type character with the same kind parameter as STRING.  
  BACK (opt) Must be of type logical.  
Results:  The result type is default integer.

If BACK is omitted (or is present with the value false) and STRING has at least one character that is in SET, the value of the result is the position of the leftmost character of STRING that is in SET.

If BACK is present with the value true and STRING has at least one character that is in SET, the value of the result is the position of the rightmost character of STRING that is in SET.

If no character of STRING is in SET or the length of STRING or SET is zero, the value of the result is zero.  

Examples

SCAN ('ASTRING', 'ST') has the value 2.

SCAN ('ASTRING', 'ST', BACK=.TRUE.) has the value 3.

SCAN ('ASTRING', 'CD') has the value zero.


Previous Page Next Page Table of Contents