c----------------------------------------------------------------------- c c Name: c FUNCTION STRLEN c c Purpose: c Find the length of a string c (number of characters up to the last non-blank character) c c Usage: c RESULT = STRLEN( STRING ) c c Input: c STRING String variable c c Output: c RESULT Length of string c (if string contains all blanks, RESULT=0) c c Revised: c Liam.Gumley@ssec.wisc.edu c $Id: strlen.f,v 1.4 1999/11/11 20:04:46 gumley Exp $ c c----------------------------------------------------------------------- integer function strlen( string ) implicit none c ... arguments character*(*) string c ... local variables integer i c ... initialize result to zero string length strlen = 0 c ... search from end of string to find first non-blank character do i = len( string ), 1, -1 if( string( i : i ) .ne. ' ' ) then strlen = i return endif end do end