TRIMLEN man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]

TRIMLEN(3F)					       Last changed: 3-3-97

NAME
     TRIMLEN - Returns the length of a character argument without counting
     trailing blanks

SYNOPSIS
     INTEGER trimlen
     intlen = TRIMLEN(string)

IMPLEMENTATION
     UNICOS, UNICOS/mk, and IRIX systems

DESCRIPTION
     TRIMLEN is an integer function that returns the length of a character
     argument without counting the trailing blanks.  The function must be
     declared as type integer in the calling routine.  The string argument
     must be of type character.

     This function is intended for use as part of the substring notation.
     Examples 2 and 3 show the TRIMLEN function used in this manner.  The
     value of each of the parts of the substring notation must be as
     follows:

	  1 <= leftmostpos <= rightmostpos <= stringlength

     leftmostpos is the leftmost character position in the substring,
     rightmostpos is the rightmost character position in the substring, and
     stringlength is the declared length of the character entity.  TRIMLEN
     returns a value of 1 for a string of all blanks.

EXAMPLES
     Example 1:	 A program using the function TRIMLEN could do the
     following:

	    INTEGER TRIMLEN
	    CHARACTER*80 STRING
	    STRING = ' '
	    STRING(20:47) = 'TEST TRIMLEN LENGTH RETURNED'
	    INTLEN = TRIMLEN(STRING)
	    WRITE(6,1) INTLEN, STRING(1:INTLEN)
	  1 FORMAT(' LENGTH=',I5,' STRING=',A,'-DONE')
	    PRINT 2,'12345678901234567890123456789012345678901234567890'
	  2 FORMAT(21X,A)
	    END

     The output of the program is as follows:

      LENGTH=  47 STRING=		  TEST TRIMLEN LENGTH RETURNED-DONE
		       12345678901234567890123456789012345678901234567890

     Example 2:	 This example produces a string with the character <
     written following the last nonblank character of STRING:

	      WRITE(6,901)STRING(1:TRIMLEN(STRING))
	  901 FORMAT(' The string is >',A,'<')

     Example 3:	 In this example, although NEW may have trailing blanks,
     the character < is written after the last nonblank character in
     STRING:

	  NEW = STRING(1:TRIMLEN(STRING)) // '< The end'

SEE ALSO
     Application Programmer's Library Reference Manual, publication SR-
     2165, for the printed version of this man page.
[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net