170. Use an implied do loop with TRIM to print an array of character variables without trailing blanks.#
topic: Character variables
Note
This tip is a draft1.
Since TRIM is not elemental, use an implied do loop with TRIM to print an array of character variables without trailing blanks:
print “(*(a,:,’,’))”,(trim(s(i)),i=1,size(s))
A function can join trimmed strings as shown.
Since TRIM is not elemental, use an implied do loop with TRIM to print an array of character variables without trailing blanks:
— FortranTip (@fortrantip) March 29, 2022
print "(*(a,:,','))",(trim(s(i)),i=1,size(s))
A function can join trimmed strings as shown. pic.twitter.com/u6GPRscyBm
- 1
From the perspective of FortranTip Browser, “draft” means that it hasn’t been edited for formatting, hasn’t had corresponding Fortran programs added, the text content hasn’t been enhanced, etc. Draft texts are extracted from the corresponding Tweet using the Twitter API.