The function is called by:
n = lnblnk( a1 ) |
|||
a1 |
character |
Input |
String |
Return value |
INTEGER*4 orINTEGER*8 |
Output |
n>0: Index of last nonblank in a1 n=0: a1 is all nonblankINTEGER*8 returned in 64-bit environments |
Example: index(), rindex(), lnblnk():
demo% cat tindex.f * 123456789012345678901 character s*24 / ’abcPDQxyz...abcPDQxyz’ / INTEGER*4 declen, index, first, last, len, lnblnk, rindex declen = len( s ) first = index( s, ’abc’ ) last = rindex( s, ’abc’ ) lastnb = lnblnk( s ) write(*,*) declen, lastnb write(*,*) first, last end demo% f95 tindex.f demo% a.out 24 21 <- declen is 24 because intrinsic len() returns the declared length of s 1 13 |
Programs compiled to run in a 64-bit environment must declare index, rindex and lnblnk (and their receiving variables) INTEGER*8 to handle very large character strings.