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



On 2007-04-28 11:00:00 -0300, dpb <bozarth.d@xxxxxxxxx> said:

On Apr 28, 5:07 am, glen herrmannsfeldt <g...@xxxxxxxxxxxxxxxx> wrote:
Richard Maine wrote:

(someone 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.
I don't see that as analogous. Or at any rate, I don't
think it a robust analogy.
The i0 for integers doesn't modify the value printed out. It just avoids
adding blank padding characters.
For the character case, you aren't talking about padding. Instead, you
are talking about modifying the value printed out, as the blanks are
part of the value.

But there is already an A descriptor that doesn't add padding, and
that is just A. Why isn't the no padding I descriptor just I?
...
I don't think that's a standard interpretation of the A descriptor --
the implied width of field with a missing field width specifier is a
compiler-supplied default. For the A descriptor, the default is the
actual length of the specified i/o item.

One guesses that the intent was to use A with TRIM of something.

The original request was to have TRIM applied to an array of
character variables produce an array in which each element could
have a different length. The place this would be of use would be
in an I/O list as otherwise an assignment would just get a new
fixed length back. I suppose one could also think of doing a
concatenation of the variable length pieces before doing the
assignment. This would build up full names from first and last names
without the confusion of all the first names being padded to a fixed
length. Perhaps it might be a nice example of FORALL doing something
that a regular array assignment does not have access to.






.



Relevant Pages