Re: Write A, left justified, howto?




Arjen Markus wrote:
Jeremy schreef:

How can I make the following print ID, Code and Name left justified not
right? I found that if I pad ID, Code and Name to be longer than the
desired output then it becomes left justified.

write(*, '(A4,1X,A10,1X,A10)') 'ID', 'Code', 'Name'

prints:

ID Code Name
---- ---------- ----------

(-'s added for clarity)
....

The A edit descriptor is explicitly designed to do it that way, but how
about
a small helper function?

program padding

Assuming your variables are defined with lengths that correspond to the
lengths of the printed fields, and all you want to do is print each
left justified, then ADJUSTL by itself will do; it removes leading
blanks and pads on the right with blanks.

.


Quantcast