I have a little problem which I wonder if any of you have dealt with.
If I do
display %5.0g 23
I get " 23", that is, the textual form of the number is right-justified
in a field of five characters.
(In real life, I have something more complex in place of the 23.)
Nut if I do
file write filehandle 5%.0g (23)
then the leading spaces are trimmed, and thus it is no longer right-justified.
I thought I could use string(23, "5%.0g"), but this, too, trims spaces.
I can think of a solution (untested):
local t1 = string(23, "5%.0g")
local len1 = length("`t1'")
local len2 = 5 - `len1'
file write filehandle _dup(`len2') " " "`t1'"
-- but I wonder if there is a simpler solution that I've overlooked.
Thanks if anyone can help.
-- David
David Kantor
Institute for Policy Studies
Johns Hopkins University
dkantor@jhu.edu
410-516-5404