Skip to content

Add an a0 edit descriptor analogous to the i0 descriptor #15

Open
@Beliavsky

Description

@Beliavsky

I suggest that an a0 edit descriptor be added that acts like the 'a' descriptor but TRIMs trailing spaces of a string. Because Fortran arrays of strings must have all strings the same size, many strings have redundant trailing spaces. Using the a0 descriptor you could print strings with the minimum size needed, analogous to i0 for integers. Below is an example of the requested feature.

program main
implicit none
integer, parameter :: n = 4
character (len=10) :: c(n)
integer            :: i
c = ["one  ","two  ","three","four "]
write (*,"(1000(a,1x))") (trim(c(i)),i=1,n) ! output: "one two three four"
! desired syntax in line below, to do the same thing as line above:
! write (*,"(1000(a0,1x))") c 
end program main

Metadata

Metadata

Assignees

No one assigned

    Labels

    Clause 13Standard Clause 13: Input/output editingFortran 2023Proposal targeting the next Fortran standard F2023 (previously called F202X)in progressJ3 is moving forward

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions