该函数的调用方式如下所示:
n = lnblnk( a1 ) |
|||
a1 |
字符 |
输入 |
字符串 |
返回值 |
INTEGER*4 或 INTEGER*8 |
输出 |
n>0:a1 中最后一个非空白字符串的索引 n=0:a1 全部不为空白,在 64 位环境中返回 INTEGER*8 值 |
示例: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 |
对于编译为要在 64 位环境中运行的程序,必须将 index、rindex 和 lnblnk(以及它们的接收变量)声明为 INTEGER*8,以便处理非常大的字符串。