Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ lnblnk(3F) — Sun WorkShop 3.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

INDEX(3F)  —  FORTRAN LIBRARY ROUTINES

NAME

index, rindex, lnblnk, len − get index/length of substring

SYNOPSIS/USAGE

CHARACTER∗(∗) string, substr
n = INDEX (string, substr)
INTEGER FUNCTION rindex
CHARACTER∗(∗) string, substr
n = rindex (string, substr)
FUNCTION lnblnk
CHARACTER∗(∗) string
n = lnblnk (string)
CHARACTER∗(∗) string
n = LEN (string)

DESCRIPTION

INDEX(a1,a2) returns index of first occurrence of string a2 in string a1, or zero if it does not occur.  (intrinsic function)

rindex(a1,a2) returns index of last occurrence of string a2 in string a1, or zero if it does not occur. 

lnblnk( a1 ) returns the index of the last non-blank character in a1.  This is useful since all f77 character objects are fixed length, blank padded. 

LEN returns declared size of character string argument.  (intrinsic function)

EXAMPLE

Example: LEN(), INDEX(), rindex(), lnblnk().
∗                         123456789 123456789 1234
        CHARACTER s∗24 / ’abcPDQxyz...abcPDQxyz   ’ /
        INTEGER declen, first, last, lnblnk, rindex
        declen = LEN( s )
        first = INDEX( s, ’abc’ )
        last = rindex( s, ’abc’ )
        lastnb = lnblnk( s )
        WRITE(∗,∗) declen, lastnb, first, last
        END
demo$ f77 -silent tindex.f
demo$ a.out
32 21  1 13
demo$
In the above example, declen is 32, not 21.

FILES

libF77.a

Sun Release 4.1  —  Last change: 19 April 1994

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026