Re: add a0 format to language to print trimmed character variables



On Apr 27, 5:25 pm, Beliavsky <beliav...@xxxxxxx> wrote:
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.

I am with you. Did you send your suggestion to Andy? Perhaps he can
implement it in g95

Michael

.



Relevant Pages