雪球你推荐的文章太好了,但里面有一句话可能有歧义:
“此时我们就需要 AdjustL 函数,我们可以这样写: trim(AdjustL(s4)) , 或者 AdjustL(trim(s4)) 这两者的顺序无所谓,结果都是一样的。”
两者的结果好像并不一样:
[Fortran] 纯文本查看 复制代码 character(len=12):: domain
open(123,file='output.txt')
domain = ' fcode.cn' ! 10 characters with 2 spaces ahead
write(123, *) 'adjustl(trim(domain)):',adjustl(trim(domain))
write(123, *) 'trim(adjustl(domain)):',trim(adjustl(domain))
print*,'length of adjustl(trim(domain)) is' ,len(adjustl(trim(domain)))
print*,'length of trim(adjustl(domain)) is',len(trim(adjustl(domain)))
end
|