FortranStrings

FORTRAN-20 Version 11 supports extensions for handling character string data not found in the FORTRAN 77 standard or earlier versions of the FORTRAN-20 compiler.

Substring references

v([e1]:[e2])

or

a(s[,s]...)([e1]:[e2])

where:

vcharacter variable name
acharacter array name
sarray subscript
e1integer expression for leftmost character of substring (default: 1)
e2integer expression for rightmost character of substring (default: last character in variable or array element)

Concatenation operator

c1 // c2 [// c3]...

where:

c1,c2,c3character constants, variables, array elements, substrings, function references, or expressions

Intrinsic functions

CHAR (i)convert integer ASCII code i to character
ICHAR (c)convert character c (or first character of string) to ANSI code
LEN (c)length of character variable or array element c (allocated size, not length of current value)
INDEX (c1, c2)position within character string c1 at which substring c2 begins; returns 0 if c2 is not found in c1

Useful functions

LENST -- Find last non-blank in character string

Returns 0 for all blank string.

      FUNCTION LENST (CSTR)
      CHARACTER*(*) CSTR
      LENST = LEN (CSTR)
100   IF (LENST.EQ.0 .OR. CSTR(LENST:LENST).NE.' ') GO TO 200
        LENST = LENST - 1
        GO TO 100
200   CONTINUE
      RETURN
*2345c---1---------2---------3---------4---------5---------6---------7--

Reference

TOPS-10/TOPS-20 FORTRAN Language Manual. Feb. 1987. Digital Equipment Corporation.