bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printf issue with thousands separator


From: Martin Michel
Subject: Re: printf issue with thousands separator
Date: Tue, 5 Jul 2022 10:08:53 +0200
User-agent: NeoMutt/20170113 (1.7.2)

Hi Jürgen,

thanks for your quick reply.

> I will look into adding support for the thousands separator (but not 
> supporting the
> locales nonsense). That is, the thousands separator will always be comma and 
> not
> e.g. full-stop like in some countries and comma in others.

That would be great and I fully agree, locales support would be too much
of a requirement.

> BTW format by example should have done the job (see the APL2 language
> reference page 140):
> 
> 
>       "5,555.50" ⍕ 1234.56
> 1,234.56

Well, I tried this but it only works for the simpler cases. I could
manage to format figures with the currency symbol on the right side but
the format by examples falls short if I want it on the left, combined
with negative numbers and also rounding (e.g. no decimal point in
example spec).

So this works:

      ' -1,555,555.40 $' ⍕ 123456.789 ¯987654.12
     123,456.79 $   -987,654.12 $

But I have not found anything which would give me these results:

    $ +123,457   $ -987,654

As far as I have understood IBM APL2 Language Reference this is not
possible with format by example. I would be happy if you can convince me
otherwise, then I would indeed not need ⎕FIO.

Kind regards,
Martin








reply via email to

[Prev in Thread] Current Thread [Next in Thread]