Skip to content

Novis\Intl\NumberFormat

Writes numbers the way a language and region write them. Each method takes a whole list and a locale tag, such as "de" or "en-IN", and formats the whole list in one call.

Members

4 members.

MemberSignature
decimaldecimal(array<int|float|decimal> $numbers, string $locale, ?DigitOptions $options = null): array<string>
percentpercent(array<int|float|decimal> $numbers, string $locale, ?DigitOptions $options = null): array<string>
currencycurrency(array<int|float|decimal> $amounts, string $currency, string $locale, ?{ display?: CurrencyDisplay } $options = null): array<string>
compactcompact(array<int|float|decimal> $numbers, string $locale, ?{ display?: CompactDisplay } $options = null): array<string>

Enums

  • CurrencyDisplay { Symbol, Narrow, Name }How NumberFormat::currency writes the currency of an amount. Symbol writes the usual symbol of the language and region. This is the default. In Canada, "$" means Canadian dollars. So in English for Canada, 19.90 US dollars are written "US$19.90". Narrow writes the shortest symbol, such as "$19.90". A reader may not know which dollar it is. Name writes the name of the currency, such as "19.90 US dollars".
  • CompactDisplay { Short, Long }How a compact number is written. A compact number is a large number written short, such as "1.2K" for 1,200. Short writes "1.2K" and is the default. Long writes "1.2 thousand".

Types

DigitOptions

type DigitOptions = {    minFractionDigits?: uint,    maxFractionDigits?: uint,    grouping?: bool,};