next up previous index
Next: M508 Find One-Bits Up: CERNLIB Previous: M503 Locate the

M507 Occupied Length of a Character String

Routine ID: M507
Author(s): F. Rademakers, J. ZollLibrary: KERNLIB
Submitter: Submitted: 27.11.1984
Language: Fortran or CRevised: 05.05.1992

LENOCC returns the occupied length of a string of type CHARACTER.

Structure:

FUNCTION subprogram
User Entry Names: LENOCC

Usage:

In any arithmetic expression, LENOCC(LINE)

has the value of the occupied length of the character string LINE, i.e. the length up to and including the last non-blank character. LENOCC = 0 if LINE contains blanks only. LINE is of type CHARACTER and LENOCC is of type INTEGER.

For few trailing blanks LENOCC is slower than LNBLNK of M432, but it may be substantially faster for very many trailing blanks; the break-even point depends on the machine and is usually around 25 trailing blanks.

Method:

On some machines LINE is first scanned backwards for machine words containing all blanks, and then the remaining string is scanned for the last non-blank character.

M508


Janne Saarela
Mon Apr 3 15:06:23 METDST 1995