r****y 发帖数: 1437 | 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. :-(( |
h***o 发帖数: 539 | 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. :-((
|
a*******x 发帖数: 47 | 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. :-((
|
a*******x 发帖数: 47 | 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
|
r****y 发帖数: 1437 | 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
|
h***o 发帖数: 539 | 6 looking for job now....
【在 r****y 的大作中提到】 : Thanks. Where are you now, graduated yet? :-)
|