ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	juh+ntg-context--- via ntg-context <ntg-context@ntg.nl>
Subject: [NTG-context] Re: string.formatters
Date: Thu, 14 Nov 2024 19:23:08 +0100	[thread overview]
Message-ID: <cfe1b028-322b-4147-2bd6-7cd445ec07c9@gmail.com> (raw)
In-Reply-To: <d390b589-81f1-47c1-8109-01fd715c8fab@mailbox.org>

juh+ntg-context--- via ntg-context schrieb am 14.11.2024 um 09:18:
> Am 14.11.24 um 08:59 schrieb juh+ntg-context--- via ntg-context:
>> \starttext
>> \startluacode
>> context(string.formatters["%0.2M"](1000))
>> \stopluacode
>> \stoptext
>>
>> Gives 10.2000,00
>
> context(string.formatters["%M"](1000))
>
> Gives the right result. But I am still confused.
You can't specify the precision but it's possible to set the thousand 
separator
(no idea for the rule what can be used as separator).

\starttext
\cldcontext{string.formatters["\letterpercent .m"](1)}
\cldcontext{string.formatters["\letterpercent .m"](10)}
\cldcontext{string.formatters["\letterpercent .m"](100)}
\cldcontext{string.formatters["\letterpercent .m"](1000)}
\cldcontext{string.formatters["\letterpercent .m"](10000)}
\cldcontext{string.formatters["\letterpercent .m"](100000)}
\cldcontext{string.formatters["\letterpercent .m"](1000000)}
\cldcontext{string.formatters["\letterpercent .m"](10000000)}
\cldcontext{string.formatters["\letterpercent .m"](100000000)}
\stoptext

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

      reply	other threads:[~2024-11-14 18:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-15  8:59 [NTG-context] max function in spreadsheettable juh+ntg-context--- via ntg-context
2024-10-15 10:42 ` [NTG-context] " Henning Hraban Ramm
2024-10-15 12:33   ` juh+ntg-context--- via ntg-context
2024-10-15 15:16     ` Hans Hagen via ntg-context
2024-10-15 19:37       ` juh+ntg-context--- via ntg-context
2024-10-15 19:58         ` Wolfgang Schuster
2024-10-16  5:43           ` juh+ntg-context--- via ntg-context
2024-10-15 20:04         ` Henning Hraban Ramm
2024-11-14  7:59       ` [NTG-context] string.formatters (was: Re: max function in spreadsheettable) juh+ntg-context--- via ntg-context
2024-11-14  8:18         ` [NTG-context] Re: string.formatters juh+ntg-context--- via ntg-context
2024-11-14 18:23           ` Wolfgang Schuster [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cfe1b028-322b-4147-2bd6-7cd445ec07c9@gmail.com \
    --to=wolfgang.schuster.lists@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).