Redian新闻
>
问个Fortran字符串操作的问题
avatar
问个Fortran字符串操作的问题# Computation - 科学计算
r*y
1
Is there a function in fortran which can tell the length of a string?
For example
character*80 A
A='dfwrerefdfe'

which function can tell the length of this A?
Have not used Fortran for a long long time, so rusty now. :-((
avatar
h*o
2
integer function strlen(str)
integer i
character str*(*)
i = len(str)
do while (str(i:i) .eq. ' ')
i = i - 1
enddo
strlen = i
return
end
fortran is really awkward...

【在 r****y 的大作中提到】
: Is there a function in fortran which can tell the length of a string?
: For example
: character*80 A
: A='dfwrerefdfe'
:
: which function can tell the length of this A?
: Have not used Fortran for a long long time, so rusty now. :-((

avatar
a*x
3
use the function "len" and "len_trim".

【在 r****y 的大作中提到】
: Is there a function in fortran which can tell the length of a string?
: For example
: character*80 A
: A='dfwrerefdfe'
:
: which function can tell the length of this A?
: Have not used Fortran for a long long time, so rusty now. :-((

avatar
a*x
4
Peng

【在 h***o 的大作中提到】
: integer function strlen(str)
: integer i
: character str*(*)
: i = len(str)
: do while (str(i:i) .eq. ' ')
: i = i - 1
: enddo
: strlen = i
: return
: end

avatar
r*y
5
Thanks. Where are you now, graduated yet? :-)

【在 h***o 的大作中提到】
: integer function strlen(str)
: integer i
: character str*(*)
: i = len(str)
: do while (str(i:i) .eq. ' ')
: i = i - 1
: enddo
: strlen = i
: return
: end

avatar
h*o
6
looking for job now....

【在 r****y 的大作中提到】
: Thanks. Where are you now, graduated yet? :-)
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。