| analyst41@hotmail.com 2005-11-17, 9:57 pm |
|
James Giles wrote:
> Nestor wrote:
> ...
>
> There's a question of why you would ever trim a literal anyway.
> Of course, your point makes more sense if the argument of trim
> is an expression or another function call:
>
> TRIM(STRFCN(STUFF)) =>
> STRFCN(STUFF)(1:LTRIMG(STRFCN(STUFF))
>
> But, your solution still imposes an arbitrary size limit on the
> result string that mine does not. A better solution all around
> is for the programmer to know what the rules of the language
> are and code as necessary - or, switch to another language
> that has TRIM already: F90 comes to mind.
>
> --
> J. Giles
>
> "I conclude that there are two ways of constructing a software
> design: One way is to make it so simple that there are obviously
> no deficiencies and the other way is to make it so complicated
> that there are no obvious deficiencies." -- C. A. R. Hoare
One can produce a variable length stringarray (But its probably a Sun
f77 extension)
cat junk.f
character string1*10,string2*8
string1 = 'abcdef '
string2 = 'abcde '
call dummy(string1,len(string1))
call dummy(string2,len(string2))
stop
end
subroutine dummy(string,n)
character stringarray*1(n),string*(*)
do j = 1,n
stringarray(j) = string(j:j)
enddo
print *,stringarray
return
end
f77 junk.f
junk.f:
MAIN:
dummy:
a.out
abcdef
abcde
|