Beliavsky
2007-04-27 22:25:54 UTC
I wish there were an "a0" format for character variables, analogous to
i0 for integers, which would not print trailing spaces in character
variables. For example,
character (len=5) :: words(4) = (/"one ","two ","three","four "/)
write (*,"(100(1x,a0))") words
would print
one two three four
The TRIM function is not elemental, so one cannot write
write (*,"(100(1x,a))") trim(words)
Currently I write
write (*,"(100(1x,a))") (trim(words(i)),i=1,size(words))
which is slightly awkward IMO.
i0 for integers, which would not print trailing spaces in character
variables. For example,
character (len=5) :: words(4) = (/"one ","two ","three","four "/)
write (*,"(100(1x,a0))") words
would print
one two three four
The TRIM function is not elemental, so one cannot write
write (*,"(100(1x,a))") trim(words)
Currently I write
write (*,"(100(1x,a))") (trim(words(i)),i=1,size(words))
which is slightly awkward IMO.