Re: add a0 format to language to print trimmed character variables
- From: Beliavsky <beliavsky@xxxxxxx>
- Date: 29 Apr 2007 12:52:50 -0700
On Apr 29, 2:33 pm, Gary Scott <garylsc...@xxxxxxxxxxxxx> wrote:
Clive Page wrote:
In message <YrOdnaEiBo7Xk67bnZ2dnUVZ_tqnn...@xxxxxxxxxxx>, glen
Beliavsky 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 think that's an excellent suggestion - pity nobody thought of it in
time for F2003.
In order to be analogous to I0 though wouldn't it need to trim both
leading and trailing spaces? I don't think that would be the usual
desire though, but maybe you could specify '0a0' to trim leading and
trailing spaces.
ADJUSTL can be (and is) ELEMENTAL, unlike TRIM, because the LEN of the
RESULT is the same as that of the argument. Quoting the gfortran
documentation, "ADJUSTL(STR) will left adjust a string by removing
leading spaces. Spaces are inserted at the end of the string as
needed."
If a0 were in the language, one could just write
write (*,"(1000(1x,a0))") adjustl(char_vec)
to print an array of character variables with leading and trailing
spaces removed from character variables and one space inserted between
variables.
.
- Follow-Ups:
- Re: add a0 format to language to print trimmed character variables
- From: Gary Scott
- Re: add a0 format to language to print trimmed character variables
- References:
- add a0 format to language to print trimmed character variables
- From: Beliavsky
- Re: add a0 format to language to print trimmed character variables
- From: michael
- Re: add a0 format to language to print trimmed character variables
- From: Richard Maine
- Re: add a0 format to language to print trimmed character variables
- From: glen herrmannsfeldt
- Re: add a0 format to language to print trimmed character variables
- From: Clive Page
- Re: add a0 format to language to print trimmed character variables
- From: Gary Scott
- add a0 format to language to print trimmed character variables
- Prev by Date: Re: add a0 format to language to print trimmed character variables
- Next by Date: Re: add a0 format to language to print trimmed character variables
- Previous by thread: Re: add a0 format to language to print trimmed character variables
- Next by thread: Re: add a0 format to language to print trimmed character variables
- Index(es):
Relevant Pages
|