Manual: English (arqamEN)
Manual: English (arqamEN)
arqamEN, the English engine of Arqam: numbers and amounts in English words. It is reached through the library by an English locale; for both languages at once and for documents, see the library's manual.
1. Quick start
arqamEN writes numbers and amounts in English words, through the library: load arqam/en and give an English locale (see the library's manual). Two ways to call it: NumberFormat, the shape and the option names of JavaScript's own Intl.NumberFormat (chapter 2), and toWords(), with every option of the engine (chapters 3 and after).
import arqam from "arqam";
import "arqam/en"; // English, by its locale
new arqam.NumberFormat("en-GB", {currency: "QAR"}).format(1250.5);
// One Thousand Two Hundred and Fifty Qatari Riyals and Fifty Dirhams
arqam("1250.50", "en-US", {currency: "QAR"});
// One Thousand Two Hundred Fifty Qatari Riyals and Fifty Dirhams
new arqam.NumberFormat("en-GB", {currency: "QAR"}).format("1250.5")new arqam.NumberFormat("en-US", {currency: "USD", brackets: "end", only: "end"}).format("99.5")arqam("2026", "en-US")arqam("1250.50", "en-US", {currency: "QAR"})arqam("21", "en-US", {style: "ordinal"})2. NumberFormat: as Intl
arqam.NumberFormat(locales, options) with an English locale has the shape, the option names and the methods of JavaScript's Intl.NumberFormat, but it writes words; arqamAR.NumberFormat does the same for Arabic. Whoever knows Intl can use it at once. It is built on toWords(), so its words are toWords' words.
The locale decides the English
«en» alone and the American locales (en-US …) write no «and»: «One Hundred Twenty-One». Every other English locale (en-GB, en-AU, en-IN, en-ZA …) writes it: «One Hundred and Twenty-One». en-IN, en-PK, en-BD and en-NP count in lakh and crore. The figure in brackets is written as the locale writes figures: 1,250.50, 1,23,456.50 in en-IN, 1 250,50 in en-ZA. variant ("us", "uk") and scale ("indian", "short") choose otherwise.
new arqam.NumberFormat("en-US", {currency: "QAR", brackets: "end"}).format("1250.5")new arqam.NumberFormat("en-GB", {currency: "QAR", brackets: "end"}).format("1250.5")new arqam.NumberFormat("en-IN", {currency: "INR", brackets: "end", only: "end"}).format("123456.5")new arqam.NumberFormat("en-IN", {currency: "INR", scale: "short"}).format("123456")new arqam.NumberFormat("en-ZA", {currency: "ZAR", brackets: "start"}).format("1250.5")new arqam.NumberFormat("en-GB", {variant: "us"}).format("121")The options
Intl's names, with Intl's meaning:
| Option | Values | What it does |
|---|---|---|
style | "decimal" (default) · "currency" · "percent" · "ordinal" | a number, an amount, a percentage (the number times 100, as Intl: 0.125 is Twelve point Five Percent), an ordinal (Arqam's own) |
currency | an ISO code | the currency; required with style currency |
currencyDisplay | "code" (default) · "symbol" · "narrowSymbol" · "name" · "native" | the label of the figure in brackets: QAR, QR or $, Qatari Riyal, ر.ق. |
maximumFractionDigits | 0–100 | round to so many places first (half up, unless roundingMode is trunc) |
roundingMode | "trunc" (default) · "halfExpand" | cut the places beyond the currency's, as a cheque, or round them |
signDisplay | "auto" (default) · "negative" · "never" | «Negative» before a negative number, or no sign (in the figure too) |
numberingSystem | "latn" | the only one |
Arqam's own: variant and scale (above), and every option of toWords() (chapter 4) but style, whose name is Intl's here: brackets, only, textFormat (also "upper", "lower", "sentence"), noCountry, comma, compact, decFormat … When an Intl name and an Arqam name are both given, Arqam's wins (code over currency, symbol over currencyDisplay). An option name it does not know is a TypeError, with the nearest name; Intl's options for figures (useGrouping, notation …) are a RangeError.
new arqam.NumberFormat("en-GB", {currency: "QAR", brackets: "end", only: "end"}).format("1250.5")new arqam.NumberFormat("en-GB", {currency: "USD", brackets: "end", only: "end", textFormat: "upper"}).format("99.5")new arqam.NumberFormat("en-GB", {currency: "EUR", brackets: "end", currencyDisplay: "symbol"}).format("1250.5")new arqam.NumberFormat("en-GB", {currency: "QAR", roundingMode: "halfExpand", brackets: "end"}).format("3.456")new arqam.NumberFormat("en-GB", {maximumFractionDigits: 1}).format("3.456")new arqam.NumberFormat("en-GB", {currency: "USD", signDisplay: "never", brackets: "end"}).format("-75")new arqam.NumberFormat("en-GB", {style: "percent", brackets: "end"}).format("0.125")new arqam.NumberFormat("en-GB", {style: "ordinal"}).format("121")new arqam.NumberFormat("en-GB", {brackts: "end"}).format("5")The methods
As Intl's, and bound, so list.map(nf.format) works; the formatter is frozen.
| Method | What it gives |
|---|---|
format(x) | the words; a list gives a list |
formatToParts(x) | the words in typed parts, with Intl's type names where Intl has one (integer, decimal, fraction, currency, minusSign, percentSign, literal) and Arqam's own: minorCurrency, denominator, ordinal, prefix and suffix («Only»), figure (with its own parts, as Intl cuts figures). The values joined give format(x). |
formatRange(a, b) | «From A to B», with «Only» and the figure once; equal values give one value; a start after the end is a RangeError |
formatRangeToParts(a, b) | the parts of formatRange, each with its source: startRange, endRange or shared |
resolvedOptions() | the locale and the options in force |
NumberFormat.supportedLocalesOf(list) | the English locales of the list |
new arqam.NumberFormat("en-GB", {currency: "QAR", brackets: "end"}).formatToParts("1250.5")new arqam.NumberFormat("en-GB", {currency: "QAR", brackets: "end", only: "end"}).formatRange(1000, 2000)new arqam.NumberFormat("en-IN", {currency: "INR", brackets: "start"}).formatRange(100000, 250000)new arqam.NumberFormat("en-IN", {currency: "INR"}).resolvedOptions()arqam.NumberFormat.supportedLocalesOf(["en-GB", "ar-QA", "en-in"])3. Numbers and amounts
An amount is style: "currency" with its currency, as in Intl; a currency alone (in the call or set with config()) makes an amount too. The options of a call apply to that call only. Before, the second parameter was the options or a code (mode: "currency", config()): mode is still taken; the second parameter is now the locale. ult").
arqam("12.5", "en-US", {currency: "KWD"})arqam("12.5", "en-US", {mode: "currency", currency: "KWD"})arqam("12.5", "en-US", {currency: "KWD"})4. Every option
Each option: what it does and why, its values, what else to know, examples of different uses, and the options it works with. They go in the options of arqam(n, locale, options) and new arqam.NumberFormat(locale, options), beside Intl's.
mode
Every option › mode
Format
arqam(number, "en", {mode: value})
new arqam.NumberFormat("en", {mode: value}).format(number)
arqamEN.config({mode: value})| Values | Default |
|---|---|
"" | "currency" | "ordinals" | "" |
Description
Says what the number is: a plain number, an amount of money, or a position in a list (an ordinal). The same digits are written differently in each: 12.5 is «Twelve point Five» as a number and «Twelve Qatari Riyals and Fifty Dirhams» as an amount.
Values
| Value | Meaning |
|---|---|
"" | a number (the default) |
"currency" | an amount; "c" is the short form |
"ordinals" | an ordinal, First, Twenty-First; "o" is the short form |
The shortcut
A currency code given as text, toWords(n, "QAR"), is the same as {mode: "currency", currency: "QAR"}. An options object needs the mode: with only a code the number is still written as a number.
Ordinals
Only the whole number is used: 12.5 gives «Twelfth».
Examples
arqam("12.5", "en-US")arqam("12.5", "en-US", {mode: "currency", currency: "QAR"})arqam("12.5", "en-US", {currency: "QAR"})arqam("12.5", "en-US", {currency: "QAR"})arqam("21", "en-US", {mode: "o"})arqam("121", "en-GB", {mode: "o"})Works with
code (the currency of an amount), style (also for ordinals).
Errors
A value that is not one of the above is an error that names the option:
arqam("5", "en-US", {mode: "x"})currency
Every option › currency
Format
arqam(number, "en", {currency: value})
new arqam.NumberFormat("en", {currency: value}).format(number)
arqamEN.config({currency: value})| Values | Default |
|---|---|
"QAR" | "" | "QAR" |
Description
The currency of an amount, by its ISO 4217 code, with style: "currency" (Intl's names). It gives the currency's names (with its country's adjective), the names of its minor unit, its number of decimal places and its symbols.
Values
| Value | Meaning |
|---|---|
"QAR" | any of the 188 codes of Arqam's table, in any letter case |
"" | none (the default) |
Places
The amount is counted in the currency's places: two for the riyal, three for the Kuwaiti dinar, none for the yen. Digits beyond them are rounded half up, as Intl (roundingMode: "trunc" cuts them).
The name
currency is Intl's name; code is not an option (a TypeError that says so).
An unknown code
It is an error that says how to add it: registerCurrency(), or the names given in the call (see demonym, major, minor…). With a code, names given in the call are not used.
Examples
arqam("12.5", "en-US", {currency: "qar"})arqam("12.5", "en-US", {mode: "currency", currency: "QAR"})arqam("3.4567", "en-US", {currency: "KWD"})arqam("1250.5", "en-US", {currency: "JPY"})arqam("1", "en-US", {currency: "QAR"})arqam("12.5", "en-US", {currency: "XYZ"})Works with
mode, noCountry, brackets and symbol, rounding.
Errors
A value that is not one of the above is an error that names the option:
arqam("5", "en-US", {currency: "x"})style
Every option › style
Format
arqam(number, "en", {style: value})
new arqam.NumberFormat("en", {style: value}).format(number)
arqamEN.config({style: value})| Values | Default |
|---|---|
"" | "uk" | "" |
Description
American or British English, given by the locale: en-GB (UK) or en-US (US); variant: "uk" or "us" gives it with any locale. (style is Intl's: decimal, currency, percent, ordinal.) British English writes «and» before the tens and units: «One Hundred and One»; American English leaves it out. The «and» comes only before the last part when it is under one hundred, so «Fifteen Thousand Four Hundred» has none.
Values
| Value | Meaning |
|---|---|
"" | US style (the default): no «and» |
"uk" | UK style |
Examples
arqam("101", "en-GB")arqam("1250", "en-GB")arqam("15400", "en-GB")arqam("1000001", "en-GB")arqam("2.5", "en-GB", {mode: "currency", currency: "GBP"})arqam("121", "en-GB", {mode: "o"})Works with
comma (a comma between the groups, the usual British cheque form), mode.
only
Every option › only
Format
arqam(number, "en", {only: value})
new arqam.NumberFormat("en", {only: value}).format(number)
arqamEN.config({only: value})| Values | Default |
|---|---|
"" | "end" | "start" | "" |
Description
Adds «Only», as on cheques and payment orders, so that nothing can be written after (or before) the amount.
Values
| Value | Meaning |
|---|---|
"" | none (the default) |
"end" | after the words: the usual form |
"start" | before the words |
With brackets
«Only» comes before the figure in brackets.
Examples
arqam("99.5", "en-US", {mode: "currency", currency: "USD", only: "end"})arqam("99.5", "en-US", {mode: "currency", currency: "USD", only: "start"})arqam("99.5", "en-US", {mode: "currency", currency: "USD", only: "end", brackets: "end"})arqam("99.5", "en-US", {mode: "currency", currency: "USD", only: "end", textFormat: "U"})arqam("99", "en-US", {only: "end"})Works with
Errors
A value that is not one of the above is an error that names the option:
arqam("5", "en-US", {only: "x"})comma
Every option › comma
Format
arqam(number, "en", {comma: value})
new arqam.NumberFormat("en", {comma: value}).format(number)
arqamEN.config({comma: value})| Values | Default |
|---|---|
"" | "on" | "" |
Description
Puts a comma between the groups of a long number (millions, thousands …), which makes it easier to read aloud and is common on British cheques.
Values
| Value | Meaning |
|---|---|
"" | no commas (the default) |
"on" | a comma after each group |
Where
A comma comes before each group of one hundred or more; before a last group under one hundred there is none: «Five Million One».
Examples
arqam("12123101", "en-US", {comma: "on"})arqam("12123001", "en-US", {comma: "on"})arqam("1250", "en-GB", {comma: "on"})arqam("12123001.5", "en-US", {mode: "currency", currency: "QAR", comma: "on"})Works with
Errors
A value that is not one of the above is an error that names the option:
arqam("5", "en-US", {comma: "x"})compact
Every option › compact
Format
arqam(number, "en", {compact: value})
new arqam.NumberFormat("en", {compact: value}).format(number)
arqamEN.config({compact: value})| Values | Default |
|---|---|
"" | "on" | "" |
Description
Writes each group as figures with its scale word: «12 Million 123 Thousand 1». Shorter than full words for very large numbers, for reports and screens where a cheque's full words are not needed.
Values
| Value | Meaning |
|---|---|
"" | full words (the default) |
"on" | the groups as figures |
Examples
arqam("12123001", "en-US", {compact: "on"})arqam("2500000", "en-US", {mode: "currency", currency: "USD", compact: "on"})arqam("1250000.75", "en-US", {compact: "on"})Works with
comma, decFormat (the fraction in figures too).
Errors
A value that is not one of the above is an error that names the option:
arqam("5", "en-US", {compact: "x"})brackets
Every option › brackets
Format
arqam(number, "en", {brackets: value})
new arqam.NumberFormat("en", {brackets: value}).format(number)
arqamEN.config({brackets: value})| Values | Default |
|---|---|
"" | "end" | "start" | "" |
Description
Writes the amount in figures, in brackets, beside the words: before them or after them. This is how a cheque, an invoice or a contract writes an amount: the words in full and the figure beside them, so a reader can check one against the other.
Values
| Value | Meaning |
|---|---|
"" | none (the default): the words only |
"end" | after the words, and after «Only» when only is given: the usual form on cheques and invoices |
"start" | before the words: a heading or a list of amounts |
What is in the brackets
The label (the currency's ISO code by default; see symbol), then the amount with a thousands separator and all the currency's decimal places: 1250.5 is written 1,250.50 in riyals, 1,250.500 in dinars, 1,250 in yen. A negative amount keeps its sign. A number without a currency has no label; ordinals have no figure.
Examples
arqam("1250.5", "en-US", {mode: "currency", currency: "QAR", brackets: "end"})arqam("1250.5", "en-US", {mode: "currency", currency: "QAR", brackets: "start"})arqam("1250.5", "en-US", {mode: "currency", currency: "QAR", brackets: "end", only: "end"})arqam("1250.5", "en-GB", {mode: "currency", currency: "KWD", brackets: "end"})arqam("1250.5", "en-US", {mode: "currency", currency: "JPY", brackets: "end"})arqam("-75", "en-US", {mode: "currency", currency: "USD", brackets: "end"})arqam("1250.5", "en-US", {mode: "currency", currency: "QAR", brackets: "end", symbol: "l"})arqam("1250.5", "en-US", {
mode: "currency",
currency: "EUR",
brackets: "end",
sepThousands: ".",
sepDecimal: ","
})arqam("1250.5", "en-US", {brackets: "end"})arqam("21", "en-US", {mode: "o", brackets: "end"})Works with
symbol (the label), only, sepThousands and sepDecimal, textFormat (the words only; the figure is unchanged).
symbol
Every option › symbol
Format
arqam(number, "en", {symbol: value})
new arqam.NumberFormat("en", {symbol: value}).format(number)
arqamEN.config({symbol: value})| Values | Default |
|---|---|
"" | "i" | "l" | "n" | "c" | "" |
Description
The label in the brackets: how the currency is shown beside the figure. Only used with brackets.
Values
| Value | Meaning |
|---|---|
"" | the ISO code (the default); with noCountry, the plural name |
"i" | the ISO code |
"l" | the Latin symbol (QR, $, €), else the native one |
"n" | the native symbol (ر.ق., €) |
"c" | the country's adjective and the currency's name |
| any other text | used as given |
Examples
arqam("5", "en-US", {mode: "currency", currency: "QAR", brackets: "end", symbol: "i"})arqam("5", "en-US", {mode: "currency", currency: "QAR", brackets: "end", symbol: "l"})arqam("5", "en-US", {mode: "currency", currency: "QAR", brackets: "end", symbol: "n"})arqam("5", "en-US", {mode: "currency", currency: "QAR", brackets: "end", symbol: "c"})arqam("5", "en-US", {mode: "currency", currency: "USD", brackets: "end", symbol: "US$"})arqam("5", "en-US", {mode: "currency", currency: "QAR", symbol: "l"})Works with
currencyPos
Every option › currencyPos
Format
arqam(number, "en", {currencyPos: value})
new arqam.NumberFormat("en", {currencyPos: value}).format(number)
arqamEN.config({currencyPos: value})| Values | Default |
|---|---|
"end" | "start" | "end" |
Description
Puts the currency's name before the number instead of after it, for the forms that write «Qatari Riyals Five».
Values
| Value | Meaning |
|---|---|
"end" | after the number (the default; "" is the same) |
"start" | before it |
The minor unit
Only the major name moves; the minor unit stays after its number.
Examples
arqam("5", "en-US", {mode: "currency", currency: "QAR", currencyPos: "start"})arqam("5.25", "en-US", {mode: "currency", currency: "QAR", currencyPos: "start"})arqam("5", "en-US", {mode: "currency", currency: "QAR", currencyPos: "start", brackets: "end"})Works with
Errors
A value that is not one of the above is an error that names the option:
arqam("5", "en-US", {currencyPos: "x"})noCountry
Every option › noCountry
Format
arqam(number, "en", {noCountry: value})
new arqam.NumberFormat("en", {noCountry: value}).format(number)
arqamEN.config({noCountry: value})| Values | Default |
|---|---|
"" | "on" | "" |
Description
Leaves out the country's adjective: «Twenty Dollars» instead of «Twenty US Dollars», for a document that already says which currency it uses.
Values
| Value | Meaning |
|---|---|
"" | with the adjective (the default) |
"on" | without it |
In the brackets
Without a symbol, the label is then the plural name.
Examples
arqam("20", "en-US", {mode: "currency", currency: "USD", noCountry: "on"})arqam("1", "en-US", {mode: "currency", currency: "KWD", noCountry: "on"})arqam("20.5", "en-US", {mode: "currency", currency: "GBP", noCountry: "on"})arqam("20", "en-US", {mode: "currency", currency: "USD", noCountry: "on", brackets: "end"})arqam("20", "en-US", {
mode: "currency",
currency: "USD",
noCountry: "on",
brackets: "end",
symbol: "i"
})Works with
brackets and symbol, currencyPos.
Errors
A value that is not one of the above is an error that names the option:
arqam("5", "en-US", {noCountry: "x"})textFormat
Every option › textFormat
Format
arqam(number, "en", {textFormat: value})
new arqam.NumberFormat("en", {textFormat: value}).format(number)
arqamEN.config({textFormat: value})| Values | Default |
|---|---|
"" | "U" | "L" | "S" | "" |
Description
The letter case of the words: title case (each word with a capital, the default), capitals (as cheques are often printed), lower case, or a sentence.
Values
| Value | Meaning |
|---|---|
"" | Title Case (the default) |
"U" | UPPER CASE |
"L" | lower case |
"S" | Sentence case: a capital for the first word only |
Currency names
In lower and sentence case the currency's names keep their capitals: they are names.
Examples
arqam("1234", "en-US", {textFormat: "U"})arqam("1234", "en-US", {textFormat: "L"})arqam("1234", "en-US", {textFormat: "S"})arqam("1250.5", "en-US", {mode: "currency", currency: "QAR", textFormat: "L"})arqam("1250.5", "en-US", {mode: "currency", currency: "QAR", textFormat: "S"})arqam("99.5", "en-US", {
mode: "currency",
currency: "USD",
textFormat: "U",
only: "end",
brackets: "end"
})Works with
Errors
A value that is not one of the above is an error that names the option:
arqam("5", "en-US", {textFormat: "x"})demonym, major, minor, majorPl, minorPl
Every option › demonym, major, minor, majorPl, minorPl
Format
arqam(number, "en", {demonym: …, major: …, minor: …, majorPl: …, minorPl: …})Description
A currency named in the call, with no currency: its country's adjective, its name and its minor unit's name, and their plurals. For a currency used once; to use one again and again, add it with registerCurrency().
Values
| Value | Meaning |
|---|---|
demonym | the country's adjective (Mabatowan) |
major, majorPl | the name and its plural |
minor, minorPl | the minor unit's name and its plural |
Plurals
A name given without its plural keeps one form. The minor unit has two decimal places unless decRound says otherwise. With a code, these names are not used.
Examples
arqam("5.25", "en-US", {
mode: "currency",
demonym: "Mabatowan",
major: "Koko",
majorPl: "Kokos",
minor: "Kaka",
minorPl: "Kakas"
})arqam("5.25", "en-US", {mode: "currency", demonym: "Mabatowan", major: "Koko", minor: "Kaka"})arqam("1.01", "en-US", {
mode: "currency",
major: "Token",
majorPl: "Tokens",
minor: "Cent",
minorPl: "Cents"
})arqam("3.25", "en-US", {
mode: "currency",
major: "Unit",
majorPl: "Units",
minor: "Sub",
minorPl: "Subs",
decRound: 3
})Works with
decRound
Every option › decRound
Format
arqam(number, "en", {decRound: value})
new arqam.NumberFormat("en", {decRound: value}).format(number)
arqamEN.config({decRound: value})| Values | Default |
|---|---|
"" | "" |
Description
The number of decimal places kept in a number, or in an amount of a currency named in the call. The places beyond are cut, or rounded with rounding.
Values
| Value | Meaning |
|---|---|
| a whole number | the places |
"" | the default: 10 for numbers; a currency's own places for an amount |
Amounts with a code
A currency with a code always keeps its own places: decRound does not change them.
Examples
arqam("3.456", "en-US", {decRound: 1})arqam("3.456", "en-US", {decRound: 0})arqam("3.456", "en-US", {decRound: 1, rounding: "on"})arqam("2.1234567891234", "en-US")arqam("3.456", "en-US", {mode: "currency", currency: "QAR", decRound: 3})Works with
Errors
A value that is not one of the above is an error that names the option:
arqam("5", "en-US", {decRound: "x"})rounding
Every option › rounding
Format
arqam(number, "en", {rounding: value})
new arqam.NumberFormat("en", {rounding: value}).format(number)
arqamEN.config({rounding: value})| Values | Default |
|---|---|
"" | "on" | "" |
Description
Rounds the extra decimal places (half up). As Intl, this is the default; roundingMode: "trunc" cuts them instead, as a bank does when it writes a cheque from a longer figure.
Values
| Value | Meaning |
|---|---|
"" | Intl's roundingMode decides (default half up) |
"on" | round half up |
Examples
arqam("3.456", "en-US", {currency: "QAR"})arqam("3.456", "en-US", {mode: "currency", currency: "QAR", roundingMode: "trunc"})arqam("3.456", "en-US", {mode: "currency", currency: "QAR", rounding: "on"})arqam("3.455", "en-US", {mode: "currency", currency: "QAR", rounding: "on"})arqam("9.999", "en-US", {mode: "currency", currency: "QAR", rounding: "on"})arqam("-3.456", "en-US", {mode: "currency", currency: "QAR", rounding: "on"})arqam("3.456", "en-US", {decRound: 1, rounding: "on"})Works with
decRound, code.
Errors
A value that is not one of the above is an error that names the option:
arqam("5", "en-US", {rounding: "x"})decFormat
Every option › decFormat
Format
arqam(number, "en", {decFormat: value})
new arqam.NumberFormat("en", {decFormat: value}).format(number)
arqamEN.config({decFormat: value})| Values | Default |
|---|---|
"" | "w" | "n" | "." | "/" | "th" | "tn" | "p" | "pn" | "nn" | "" |
Description
How the decimal part is written: digit by digit after «point», as one number, in figures, or as a fraction. Numbers and amounts read it differently (see «Fractions» for every form).
Values
| Value | Meaning |
|---|---|
"" | numbers: point and each digit; amounts: the minor unit in words |
"w" | numbers: point and the decimal part as one number |
"n" | point (or the minor unit) with the decimal part in figures |
"." | and 0.25 (an amount: and 0.25 Qatari Riyals) |
"/" | and 25/100 |
"th" | numbers: and Twenty-Five Hundredths |
"tn" | numbers: and 25 Hundredths |
"p" | numbers: and Twenty-Five parts of One Hundred |
"pn" | numbers: and 25 parts of One Hundred |
"nn" | numbers: and 25 parts of 100 |
Amounts
In an amount the forms that name the fraction (th, tn, p, pn, nn) write the minor unit: in words for th and p, in figures for tn, pn and nn.
Examples
arqam("3.25", "en-US", {decFormat: "w"})arqam("3.25", "en-US", {decFormat: "n"})arqam("3.25", "en-US", {decFormat: "th"})arqam("3.25", "en-US", {decFormat: "/"})arqam("3.25", "en-US", {mode: "currency", currency: "QAR", decFormat: "n"})arqam("3.25", "en-US", {mode: "currency", currency: "QAR", decFormat: "/"})arqam("3.25", "en-US", {mode: "currency", currency: "QAR", decFormat: "."})Works with
decFormatC and decFormatN, decWord, decRound.
Errors
A value that is not one of the above is an error that names the option:
arqam("5", "en-US", {decFormat: "x"})decFormatC, decFormatN
Every option › decFormatC, decFormatN
Format
arqam(number, "en", {decFormatC: …, decFormatN: …})Description
decFormat for amounts only, or for numbers only. Useful as standing options (config()) when one program writes both: the minor unit in figures for amounts, the decimal part as one number for numbers.
Values
| Value | Meaning |
|---|---|
as decFormat | decFormatC for amounts, decFormatN for numbers; each wins over decFormat |
Examples
arqam("3.25", "en-US", {mode: "currency", currency: "QAR", decFormatC: "n", decFormatN: "w"})arqam("3.25", "en-US", {decFormatC: "n", decFormatN: "w"})arqam("3.25", "en-US", {decFormat: "n", decFormatN: "th"})Works with
decWord
Every option › decWord
Format
arqam(number, "en", {decWord: value})
new arqam.NumberFormat("en", {decWord: value}).format(number)
arqamEN.config({decWord: value})Description
The word of the decimal point in numbers: «point» by default, or «dot», «decimal» or a word of your own.
Values
| Value | Meaning |
|---|---|
| a word | default "point" |
Amounts
An amount writes its minor unit, so decWord is not used.
Examples
arqam("3.25", "en-US", {decWord: "dot"})arqam("3.25", "en-US", {decFormat: "w", decWord: "Decimal"})arqam("3.25", "en-US", {mode: "currency", currency: "QAR", decWord: "dot"})Works with
negativeWord
Every option › negativeWord
Format
arqam(number, "en", {negativeWord: value})
new arqam.NumberFormat("en", {negativeWord: value}).format(number)
arqamEN.config({negativeWord: value})Description
The word before a negative number: «Negative» by default, or «Minus», «Less» or a word of your own, for statements and credit notes.
Values
| Value | Meaning |
|---|---|
| a word | default "Negative" |
Examples
arqam("-5", "en-US", {negativeWord: "Minus"})arqam("-5.5", "en-US", {mode: "currency", currency: "USD", negativeWord: "Less"})arqam("-5", "en-US", {mode: "currency", currency: "USD", negativeWord: "Minus", brackets: "end"})Works with
sepThousands, sepDecimal
Every option › sepThousands, sepDecimal
Format
arqam(number, "en", {sepThousands: …, sepDecimal: …})| Values | Default |
|---|---|
"" | "" |
Description
The separators of the figure in brackets: the thousands separator and the decimal mark. The words do not change.
Values
| Value | Meaning |
|---|---|
| a character | the separator, e.g. ".", ",", " ", "'" |
| a locale | its separator, e.g. "de-CH" for 1'234 |
"" | the computer's own (the default) |
Examples
arqam("1234.5", "en-US", {brackets: "end", sepThousands: ".", sepDecimal: ","})arqam("1234567.5", "en-US", {
mode: "currency",
currency: "EUR",
brackets: "end",
sepThousands: " ",
sepDecimal: ","
})arqam("1234.5", "en-US", {mode: "currency", currency: "CHF", brackets: "end", sepThousands: "de-CH"})Works with
isNaN
Every option › isNaN
Format
arqam(number, "en", {isNaN: value})
new arqam.NumberFormat("en", {isNaN: value}).format(number)
arqamEN.config({isNaN: value})Description
What is given back for text that is not a number, instead of an error: an empty text by default, or a word of your own to show in a form or a report.
Values
| Value | Meaning |
|---|---|
| text | default "" |
What is a number
Digits with an optional minus sign and one decimal point, as JavaScript writes them: «1234.56». A comma, a space or an exponent («1e5») makes it not a number.
Examples
arqam("12,5", "en-US", {isNaN: "?"})arqam("1e5", "en-US", {isNaN: "not a number"})arqam(" 5", "en-US", {isNaN: "not a number"})arqam("abc", "en-US")split
Every option › split
Format
arqam(number, "en", {split: value})
new arqam.NumberFormat("en", {split: value}).format(number)
arqamEN.config({split: value})| Values | Default |
|---|---|
"" | "on" | "" |
Description
Marks the parts of the words so a page can colour them: the punctuation, the currency's names, the fraction and the groups.
Values
| Value | Meaning |
|---|---|
"" | no marks (the default) |
"on" | |p punctuation, |c currency names, |f| where the fraction starts, | after each group |
Showing them
A page turns the marks into colours; the Arabic manual's 12.15 Colours: split shows how, and the marks are the same. Text shown without that script should not have them.
Examples
arqam("12.5", "en-US", {mode: "currency", currency: "QAR", split: "on"})arqam("1250", "en-US", {split: "on"})arqam("-5", "en-US", {mode: "currency", currency: "QAR", split: "on", brackets: "end"})Works with
textFormat (the marks keep their letter case).
scale
Every option › scale
Format
arqam(number, "en", {scale: value})
new arqam.NumberFormat("en", {scale: value}).format(number)
arqamEN.config({scale: value})| Values | Default |
|---|---|
"" | "indian" | "" |
Description
How large numbers are counted: by thousand, million, billion, or by lakh (a hundred thousand) and crore (ten million), as in India, Pakistan, Bangladesh and Nepal, where cheques and contracts are written so. With NumberFormat the locale chooses it (en-IN, en-PK, en-BD, en-NP: lakh and crore).
Values
| Value | Meaning |
|---|---|
"" | thousand, million … (the default; "short" is the same) |
"indian" | lakh and crore |
Large numbers
Crores are counted as numbers, so 10,000,000,000 is One Thousand Crore and 1012 One Lakh Crore.
Examples
arqam("123456", "en-US", {scale: "indian"})arqam("12345678", "en-US", {scale: "indian"})arqam("123456.5", "en-GB", {mode: "currency", currency: "INR", scale: "indian"})arqam("1000000000000", "en-US", {scale: "indian"})arqam("1234567", "en-US", {scale: "indian", compact: "on"})Works with
5. UK and US style; «Only»
US style (the default) writes no "and" inside a number; UK style writes "and" before the tens and units of the last group only: "One Thousand Two Hundred and Fifty", "One Thousand and Five", but "Fifteen Thousand Four Hundred". The library's toBilingual() and toClause() use UK style.
arqam("1250", "en-GB")arqam("1005", "en-GB")arqam("15400", "en-GB")arqam("1250", "en-US")arqam("1250.5", "en-GB", {mode: "currency", currency: "SAR", only: "end", brackets: "end"})arqam("1250.5", "en-US", {mode: "currency", currency: "SAR", only: "start"})6. Fractions
In an amount the decimal part is the minor unit (dirhams, cents …), with the currency's places. In a number it is written by decFormat:
| decFormat | Form | 3.25 |
|---|---|---|
"" | point and the digits | Three point Two Five |
"w" | point and the decimal part as a number | Three point Twenty-Five |
"n" | point and the decimal part in figures | Three point 25 |
"." | and 0.25 | Three and 0.25 |
"/" | and 25/100 | Three and 25/100 |
"th" | and twenty-five hundredths | Three and Twenty-Five Hundredths |
"tn" | and 25 hundredths | Three and 25 Hundredths |
"p" | and twenty-five parts of one hundred | Three and Twenty-Five parts of One Hundred |
"pn" | and 25 parts of 100 | Three and 25 parts of One Hundred |
"nn" | the parts in figures | Three and 25 parts of 100 |
7. The currencies
The 188 currencies of Arqam's table, with the same codes and decimals as the Arabic engine: one, two, and the smallest amount of the minor unit.
| Code | One | Two | The minor unit |
|---|---|---|---|
ABKHAZIA | One Abkhazian Apsar | Two Abkhazian Apsark | Zero Abkhazian Apsar |
ADA | One Cardano | Two Cardano | 0.01 |
AED | One UAE Dirham | Two UAE Dirhams | One Fils |
AFN | One Afghan Afghani | Two Afghan Afghani | One Pul |
ALL | One Albanian Lek | Two Albanian Lekë | One Qindarka |
AMD | One Armenian Dram | Two Armenian Dram | One Luma |
ANG | One Netherlands Antillean Guilder | Two Netherlands Antillean Guilders | One Cent |
AOA | One Angolan Kwanza | Two Angolan Kwanzas | One Centimo |
ARS | One Argentine Peso | Two Argentine Pesos | One Centavo |
ARTSAKH | One Artsakh Dram | Two Artsakh Dram | One Luma |
AUD | One Australian Dollar | Two Australian Dollars | One Cent |
AWG | One Aruban Florin | Two Aruban Florin | One Cent |
AZN | One Azerbaijani Manat | Two Azerbaijani Manat | One Qapik |
BAM | One Bosnia-Herzegovina Convertible Mark | Two Bosnia-Herzegovina Convertible Marks | One Fening |
BBD | One Barbadian Dollar | Two Barbadian Dollars | One Cent |
BCH | One Bitcoin Cash | Two Bitcoin Cash | 0.01 |
BDT | One Bangladeshi Taka | Two Bangladeshi Taka | One Poisha |
BGN | One Bulgarian Lev | Two Bulgarian Leva | One Stotinka |
BHD | One Bahraini Dinar | Two Bahraini Dinars | Ten Fils |
BIF | One Burundian Franc | Two Burundian Francs | Zero Burundian Franc |
BMD | One Bermudian Dollar | Two Bermudian Dollars | One Cent |
BNB | One Binance Coin | Two Binance Coins | 0.01 |
BND | One Brunei Dollar | Two Brunei Dollars | One Cent |
BOB | One Bolivian Boliviano | Two Bolivian Bolivianos | One Centavo |
BRL | One Brazilian Real | Two Brazilian Reais | One Centavo |
BSD | One Bahamian Dollar | Two Bahamian Dollars | One Cent |
BTC | One Bitcoin | Two Bitcoins | 0.01 |
BTN | One Bhutanese Ngultrum | Two Bhutanese Ngultrums | One Chetrum |
BWP | One Botswana Pula | Two Botswana Pula | One Thebe |
BYN | One Belarusian Ruble | Two Belarusian Rubles | One Kapiejka |
BZD | One Belize Dollar | Two Belize Dollars | One Cent |
CAD | One Canadian Dollar | Two Canadian Dollars | One Cent |
CDF | One Congolese Franc | Two Congolese Francs | One Centime |
CHF | One Swiss Franc | Two Swiss Francs | One Centime |
CKD | One Cook Islands Dollar | Two Cook Islands Dollars | One Cent |
CLP | One Chilean Peso | Two Chilean Pesos | Zero Chilean Peso |
CNY | One Chinese Yuan | Two Chinese Yuan | One Fen |
COP | One Colombian Peso | Two Colombian Pesos | One Centavo |
CRC | One Costa Rican Colón | Two Costa Rican Colones | One Centimo |
CUC | One Cuban Convertible Peso | Two Cuban Convertible Pesos | One Centavo |
CUP | One Cuban Peso | Two Cuban Pesos | One Centavo |
CVE | One Cabo Verdean Escudo | Two Cabo Verdean Escudos | One Centavo |
CZK | One Czech Koruna | Two Czech Korunas | One Haléř |
DASH | One Dash | Two Dash | 0.01 |
DJF | One Djiboutian Franc | Two Djiboutian Francs | Zero Djiboutian Franc |
DKK | One Danish Krone | Two Danish Kroner | One Øre |
DOGE | One Dogecoin | Two Dogecoins | 0.01 |
DOP | One Dominican Peso | Two Dominican Pesos | One Centavo |
DOT | One Polkadot | Two Polkadot | 0.01 |
DZD | One Algerian Dinar | Two Algerian Dinars | One Santeem |
EGP | One Egyptian Pound | Two Egyptian Pounds | One Qirsh |
EHP | One Sahrawi Peseta | Two Sahrawi Pesetas | One Centimo |
ERN | One Eritrean Nakfa | Two Eritrean Nakfa | One Cent |
ETB | One Ethiopian Birr | Two Ethiopian Birr | One Santim |
ETH | One Ether | Two Ether | 0.01 |
EUR | One Euro | Two Euros | One Cent |
FJD | One Fijian Dollar | Two Fijian Dollars | One Cent |
FKP | One Falkland Islands Pound | Two Falkland Islands Pounds | One Penny |
FOK | One Faroese Króna | Two Faroese Krónas | One Oyra |
GBP | One Pound Sterling | Two Pounds Sterling | One Penny |
GEL | One Georgian Lari | Two Georgian Lari | One Tetri |
GGP | One Guernsey Pound | Two Guernsey Pounds | One Penny |
GHS | One Ghanaian Cedi | Two Ghanaian Cedis | One Pesewa |
GIP | One Gibraltar Pound | Two Gibraltar Pounds | One Penny |
GMD | One Gambian Dalasi | Two Gambian Dalasis | One Butut |
GNF | One Guinean Franc | Two Guinean Francs | Zero Guinean Franc |
GTQ | One Guatemalan Quetzal | Two Guatemalan Quetzales | One Centavo |
GYD | One Guyanese Dollar | Two Guyanese Dollars | One Cent |
HKD | One Hong Kong Dollar | Two Hong Kong Dollars | One Cent |
HNL | One Honduran Lempira | Two Honduran Lempiras | One Centavo |
HRK | One Croatian Kuna | Two Croatian Kuna | One Lipa |
HTG | One Haitian Gourde | Two Haitian Gourdes | One Centime |
HUF | One Hungarian Forint | Two Hungarian Forint | One Fillér |
IDR | One Indonesian Rupiah | Two Indonesian Rupiah | One Sen |
ILS | One Israeli Shekel | Two Israeli Shekels | One Agora |
IMP | One Manx Pound | Two Manx Pounds | One Penny |
INR | One Indian Rupee | Two Indian Rupees | One Paisa |
IQD | One Iraqi Dinar | Two Iraqi Dinars | Ten Fils |
IRR | One Iranian Rial | Two Iranian Rials | One Dinar |
ISK | One Icelandic Króna | Two Icelandic Krónur | Zero Icelandic Króna |
JEP | One Jersey Pound | Two Jersey Pounds | One Penny |
JMD | One Jamaican Dollar | Two Jamaican Dollars | One Cent |
JOD | One Jordanian Dinar | Two Jordanian Dinars | Ten Fils |
JPY | One Japanese Yen | Two Japanese Yen | Zero Japanese Yen |
KES | One Kenyan Shilling | Two Kenyan Shillings | One Cent |
KGS | One Kyrgyz Som | Two Kyrgyz Soms | One Tyiyn |
KHR | One Cambodian Riel | Two Cambodian Riels | One Sen |
KID | One Kiribati Dollar | Two Kiribati Dollars | One Cent |
KMF | One Comorian Franc | Two Comorian Francs | Zero Comorian Franc |
KPW | One North Korean Won | Two North Korean Won | One Chon |
KRW | One South Korean Won | Two South Korean Won | Zero South Korean Won |
KWD | One Kuwaiti Dinar | Two Kuwaiti Dinars | Ten Fils |
KYD | One Cayman Islands Dollar | Two Cayman Islands Dollars | One Cent |
KZT | One Kazakhstani Tenge | Two Kazakhstani Tenge | One Tıyn |
LAK | One Lao Kip | Two Lao Kip | One Att |
LBP | One Lebanese Pound | Two Lebanese Pounds | One Qirsh |
LKR | One Sri Lankan Rupee | Two Sri Lankan Rupees | One Cent |
LRD | One Liberian Dollar | Two Liberian Dollars | One Cent |
LSL | One Lesotho Loti | Two Lesotho Maloti | One Sente |
LTC | One Litecoin | Two Litecoins | 0.01 |
LYD | One Libyan Dinar | Two Libyan Dinars | Ten Dirhams |
MAD | One Moroccan Dirham | Two Moroccan Dirhams | One Centime |
MDL | One Moldovan Leu | Two Moldovan Lei | One Ban |
MGA | One Malagasy Ariary | Two Malagasy Ariary | Zero Malagasy Ariary |
MKD | One Macedonian Denar | Two Macedonian Denari | One Deni |
MMK | One Myanmar Kyat | Two Myanmar Kyat | One Pya |
MNT | One Mongolian Tugrik | Two Mongolian Tugrik | One Möngö |
MOP | One Macanese Pataca | Two Macanese Patacas | One Avo |
MRU | One Mauritanian Ouguiya | Two Mauritanian Ouguiya | Zero Mauritanian Ouguiya |
MUR | One Mauritian Rupee | Two Mauritian Rupees | One Cent |
MVR | One Maldivian Rufiyaa | Two Maldivian Rufiyaa | One Laari |
MWK | One Malawian Kwacha | Two Malawian Kwacha | One Tambala |
MXN | One Mexican Peso | Two Mexican Pesos | One Centavo |
MYR | One Malaysian Ringgit | Two Malaysian Ringgit | One Sen |
MZN | One Mozambican Metical | Two Mozambican Meticais | One Centavo |
NAD | One Namibian Dollar | Two Namibian Dollars | One Cent |
NGN | One Nigerian Naira | Two Nigerian Naira | One Kobo |
NIO | One Nicaraguan Córdoba | Two Nicaraguan Córdobas | One Centavo |
NOK | One Norwegian Krone | Two Norwegian Kroner | One Øre |
NPR | One Nepalese Rupee | Two Nepalese Rupees | One Paisa |
NZD | One New Zealand Dollar | Two New Zealand Dollars | One Cent |
OMR | One Omani Rial | Two Omani Rials | Ten Baisa |
PAB | One Panamanian Balboa | Two Panamanian Balboas | One Centésimo |
PEN | One Peruvian Sol | Two Peruvian Soles | One Centimo |
PGK | One Papua New Guinean Kina | Two Papua New Guinean Kina | One Toea |
PHP | One Philippine Peso | Two Philippine Pesos | One Sentimo |
PKR | One Pakistani Rupee | Two Pakistani Rupees | One Paisa |
PLN | One Polish Zloty | Two Polish Zlotys | One Grosz |
PND | One Pitcairn Islands Dollar | Two Pitcairn Islands Dollars | One Cent |
PRB | One Transnistrian Ruble | Two Transnistrian Rubles | One Kopek |
PYG | One Paraguayan Guaraní | Two Paraguayan Guaraníes | Zero Paraguayan Guaraní |
QAR | One Qatari Riyal | Two Qatari Riyals | One Dirham |
RON | One Romanian Leu | Two Romanian Lei | One Ban |
RSD | One Serbian Dinar | Two Serbian Dinars | One Para |
RUB | One Russian Ruble | Two Russian Rubles | One Kopek |
RWF | One Rwandan Franc | Two Rwandan Francs | Zero Rwandan Franc |
SAR | One Saudi Riyal | Two Saudi Riyals | One Halalah |
SBD | One Solomon Islands Dollar | Two Solomon Islands Dollars | One Cent |
SCR | One Seychellois Rupee | Two Seychellois Rupees | One Cent |
SDG | One Sudanese Pound | Two Sudanese Pounds | One Qirsh |
SEK | One Swedish Krona | Two Swedish Kronor | One Öre |
SGD | One Singapore Dollar | Two Singapore Dollars | One Cent |
SHP | One Saint Helena Pound | Two Saint Helena Pounds | One Penny |
SLE | One Sierra Leonean Leone | Two Sierra Leonean Leones | One Cent |
SLL | One Sierra Leonean Leone | Two Sierra Leonean Leones | One Cent |
SLS | One Somaliland Shilling | Two Somaliland Shillings | One Cent |
SOL | One Sol | Two Sol | 0.01 |
SOS | One Somali Shilling | Two Somali Shillings | One Senti |
SRD | One Surinamese Dollar | Two Surinamese Dollars | One Cent |
SSP | One South Sudanese Pound | Two South Sudanese Pounds | One Qirsh |
STN | One São Tomé and Príncipe Dobra | Two São Tomé and Príncipe Dobras | Príncipe Dobra and One Centimo |
SVC | One Salvadoran Colón | Two Salvadoran Colones | One Centavo |
SYP | One Syrian Pound | Two Syrian Pounds | One Qirsh |
SZL | One Swazi Lilangeni | Two Swazi Emalangeni | One Cent |
THB | One Thai Baht | Two Thai Baht | One Satang |
TJS | One Tajikistani Somoni | Two Tajikistani Somoni | One Diram |
TMT | One Turkmenistan Manat | Two Turkmenistan Manat | One Tenge |
TND | One Tunisian Dinar | Two Tunisian Dinars | Ten Millime |
TOP | One Tongan Pa'anga | Two Tongan Pa'anga | One Seniti |
TRY | One Turkish Lira | Two Turkish Lira | One Kuruş |
TTD | One Trinidad and Tobago Dollar | Two Trinidad and Tobago Dollars | Tobago Dollar and One Cent |
TVD | One Tuvaluan Dollar | Two Tuvaluan Dollars | One Cent |
TWD | One New Taiwan Dollar | Two New Taiwan Dollars | One Cent |
TZS | One Tanzanian Shilling | Two Tanzanian Shillings | One Senti |
UAH | One Ukrainian Hryvnia | Two Ukrainian Hryvnias | One Kopiyka |
UGX | One Ugandan Shilling | Two Ugandan Shillings | Zero Ugandan Shilling |
USD | One US Dollar | Two US Dollars | One Cent |
USDC | One USD Coin | Two USD Coin | 0.01 |
USDT | One Tether | Two Tether | 0.01 |
UYU | One Uruguayan Peso | Two Uruguayan Pesos | One Centésimo |
UZS | One Uzbekistani Som | Two Uzbekistani Som | One Tiyin |
VED | One Venezuelan Bolívar Digital | Two Venezuelan Bolívares Digitales | One Centimo |
VES | One Venezuelan Bolívar | Two Venezuelan Bolívares | One Centimo |
VND | One Vietnamese Dong | Two Vietnamese Dong | Zero Vietnamese Dong |
VUV | One Vanuatu Vatu | Two Vanuatu Vatu | Zero Vanuatu Vatu |
WST | One Samoan Tala | Two Samoan Tala | One Sene |
XAF | One Central African CFA Franc | Two Central African CFA Francs | Zero Central African CFA Franc |
XCD | One East Caribbean Dollar | Two East Caribbean Dollars | One Cent |
XCG | One Caribbean Guilder | Two Caribbean Guilders | One Cent |
XOF | One West African CFA Franc | Two West African CFA Francs | Zero West African CFA Franc |
XPF | One CFP Franc | Two CFP Francs | Zero CFP Franc |
XRP | One Ripple | Two Ripple | 0.01 |
YER | One Yemeni Rial | Two Yemeni Rials | One Fils |
ZAR | One South African Rand | Two South African Rand | One Cent |
ZMW | One Zambian Kwacha | Two Zambian Kwacha | One Ngwee |
ZWB | One RTGS Dollar | Two RTGS Dollars | Zero RTGS Dollar |
ZWG | One Zimbabwe Gold | Two Zimbabwe Gold | One Cent |
ZWL | One Zimbabwean Dollar | Two Zimbabwean Dollars | One Cent |
8. Your own currency
A currency that is not in the table is named in the call: demonym (the adjective), major, minor and the plurals majorPl, minorPl, with style: "currency" and no currency.
arqam("7.5", "en-US", {
style: "currency",
demonym: "Mabatowan",
major: "Koko",
majorPl: "Kokos",
minor: "Kaka",
minorPl: "Kakas"
})arqam("1.01", "en-US", {
style: "currency",
demonym: "Mabatowan",
major: "Koko",
majorPl: "Kokos",
minor: "Kaka",
minorPl: "Kakas"
})9. Questions
All questions (14)
Q1Why does arqam("12.5", "en-US", {currency: "QAR"}) give an error?Beginner
As in Intl, an amount is style: "currency"; Arqam says so rather than write a plain number.
arqam("12.5", "en-US", {currency: "QAR"})arqam("12.5", "en-US", {currency: "QAR"})Q2How do I write "Only" as on a cheque?Beginner
only: "end" (or "start"); with brackets it comes before the figure.
arqam("99.5", "en-US", {mode: "currency", currency: "USD", only: "end", brackets: "end"})Q3Why does UK English give "Fifteen Thousand Four Hundred" with no "and"?Beginner
British usage puts "and" only before the tens and units: "One Thousand Two Hundred and Fifty", but "Fifteen Thousand Four Hundred".
arqam("15400", "en-GB")Q4How do I write ordinals (First, Twenty-First)?Beginner
mode: "o" (or "ordinals"); with style: "uk" the "and" goes in as for numbers.
arqam("21", "en-US", {mode: "o"})arqam("1001", "en-GB", {mode: "o"})Q5How do I write the words in capitals?Intermediate
textFormat: "U"; "L" for lower case.
arqam("1250.5", "en-US", {mode: "currency", currency: "QAR", textFormat: "U"})Q6How do I put the currency before the number?Intermediate
currencyPos: "start".
arqam("50", "en-US", {mode: "currency", currency: "EUR", currencyPos: "start"})Q7How do I leave out the country ("Dollars" not "US Dollars")?Intermediate
noCountry: "on".
arqam("20", "en-US", {mode: "currency", currency: "USD", noCountry: "on"})Q8How do I cut the extra decimals instead of rounding them?Intermediate
roundingMode: "trunc"; by default the places beyond the currency's are rounded half up, as Intl.
arqam("9.999", "en-US", {currency: "QAR"})arqam("9.999", "en-US", {currency: "QAR", roundingMode: "trunc"})Q9Is there a limit on the length of a number?Intermediate
No: the scale names go on as far as the number needs (after the 999th -illion too). There is no option for it.
arqam("1000000000000000000000000000000000000", "en-US")Q10Does it read numbers as JavaScript numbers?Intermediate
It takes the canonical text ("1234.56"), a number, or a BigInt; text is safest for large numbers and many decimals.
arqam("0.1", "en-US")Q11How do I colour the parts of the words?Advanced
split: "on" marks them: |p punctuation, |c currency names, |f| the fraction, | a group.
arqam("12.5", "en-US", {mode: "currency", currency: "QAR", split: "on"})Q12Are the currency codes and decimals the same as the Arabic engine's?Advanced
Yes: the same table of codes, and the same number of decimals, so toBilingual() writes the same amount in both languages.
arqam.toBilingual("12.345", "KWD").enQ13Why are some currency names not those of Intl (the browser)?Intermediate
Intl (CLDR, in every browser and in Node) has English names for most currencies, but they change from one version to the next, and some environments carry none; a cheque or a contract must read the same on every machine and in every year. So arqamEN keeps its own table, checked against ISO 4217 and the name each currency has where it is used: a plural only where its language has one (Naira, Ringgit), the plural of its own language (Reais, Colones, Maloti), and the ISO name where CLDR has a common one (Pound Sterling). The 45 currencies whose words differ from CLDR 49's English:
| Code | arqamEN singular | CLDR singular | arqamEN plural | CLDR plural | Why |
|---|---|---|---|---|---|
AFN | Afghan Afghani | Afghan afghani | Afghan Afghani | Afghan afghanis | no plural form in the currency's own language |
AMD | Armenian Dram | Armenian dram | Armenian Dram | Armenian drams | no plural form in the currency's own language |
AZN | Azerbaijani Manat | Azerbaijani manat | Azerbaijani Manat | Azerbaijani manats | no plural form in the currency's own language |
BDT | Bangladeshi Taka | Bangladeshi taka | Bangladeshi Taka | Bangladeshi takas | no plural form in the currency's own language (CLDR 49's British English agrees) |
BMD | Bermudian Dollar | Bermudan dollar | Bermudian Dollars | Bermudan dollars | ISO 4217 and the currency's own name: Bermudian |
BRL | Brazilian Real | Brazilian real | Brazilian Reais | Brazilian reals | the Portuguese plural, reais |
BWP | Botswana Pula | Botswanan pula | Botswana Pula | Botswanan pulas | ISO 4217: Pula; the name used in Botswana: Botswana pula, unchanged in the plural |
CRC | Costa Rican Colón | Costa Rican colón | Costa Rican Colones | Costa Rican colóns | the Spanish plural, colones |
CVE | Cabo Verdean Escudo | Cape Verdean escudo | Cabo Verdean Escudos | Cape Verdean escudos | the country's name, Cabo Verde (ISO 4217: Cabo Verde Escudo) |
ERN | Eritrean Nakfa | Eritrean nakfa | Eritrean Nakfa | Eritrean nakfas | no plural form in the currency's own language |
ETB | Ethiopian Birr | Ethiopian birr | Ethiopian Birr | Ethiopian birrs | no plural form in the currency's own language (CLDR's British English agrees) |
GBP | Pound Sterling | British pound | Pounds Sterling | British pounds | the ISO 4217 name, Pound Sterling |
GEL | Georgian Lari | Georgian lari | Georgian Lari | Georgian laris | no plural form in the currency's own language |
GTQ | Guatemalan Quetzal | Guatemalan quetzal | Guatemalan Quetzales | Guatemalan quetzals | the Spanish plural, quetzales |
GYD | Guyanese Dollar | Guyanaese dollar | Guyanese Dollars | Guyanaese dollars | the adjective of Guyana is Guyanese (ISO 4217: Guyana Dollar) |
HRK | Croatian Kuna | Croatian kuna | Croatian Kuna | Croatian kunas | Croatian kuna (withdrawn in 2023, kept for old documents) |
HUF | Hungarian Forint | Hungarian forint | Hungarian Forint | Hungarian forints | Hungarian puts no plural after a number |
IDR | Indonesian Rupiah | Indonesian rupiah | Indonesian Rupiah | Indonesian rupiahs | no plural form in the currency's own language |
ILS | Israeli Shekel | Israeli new shekel | Israeli Shekels | Israeli new shekels | the name in daily use, shekel |
KZT | Kazakhstani Tenge | Kazakhstani tenge | Kazakhstani Tenge | Kazakhstani tenges | no plural form in the currency's own language |
LAK | Lao Kip | Laotian kip | Lao Kip | Laotian kips | ISO 4217: Lao Kip; no plural form in Lao |
LSL | Lesotho Loti | Lesotho loti | Lesotho Maloti | Lesotho lotis | the Sesotho plural, maloti (CLDR's British English agrees) |
MGA | Malagasy Ariary | Malagasy ariary | Malagasy Ariary | Malagasy ariaries | no plural form in the currency's own language (CLDR's British English agrees) |
MMK | Myanmar Kyat | Myanmar kyat | Myanmar Kyat | Myanmar kyats | no plural form in the currency's own language |
MNT | Mongolian Tugrik | Mongolian tugrik | Mongolian Tugrik | Mongolian tugriks | no plural form in the currency's own language |
MRU | Mauritanian Ouguiya | Mauritanian ouguiya | Mauritanian Ouguiya | Mauritanian ouguiyas | no plural form in the currency's own language |
MVR | Maldivian Rufiyaa | Maldivian rufiyaa | Maldivian Rufiyaa | Maldivian rufiyaas | no plural form in the currency's own language (CLDR's British English agrees) |
MWK | Malawian Kwacha | Malawian kwacha | Malawian Kwacha | Malawian kwachas | kwacha, unchanged, as written in Malawi and Zambia |
MYR | Malaysian Ringgit | Malaysian ringgit | Malaysian Ringgit | Malaysian ringgits | no plural form in the currency's own language |
MZN | Mozambican Metical | Mozambican metical | Mozambican Meticais | Mozambican meticals | the Portuguese plural, meticais |
NGN | Nigerian Naira | Nigerian naira | Nigerian Naira | Nigerian nairas | no plural form in the currency's own language |
PYG | Paraguayan Guaraní | Paraguayan guarani | Paraguayan Guaraníes | Paraguayan guaranis | the Spanish name and plural, guaraní, guaraníes |
SHP | Saint Helena Pound | St. Helena pound | Saint Helena Pounds | St. Helena pounds | the ISO 4217 name, Saint Helena Pound |
SLL | Sierra Leonean Leone | Sierra Leonean leone (1964—2022) | Sierra Leonean Leones | Sierra Leonean leones (1964—2022) | CLDR adds the years of a withdrawn currency |
STN | São Tomé and Príncipe Dobra | São Tomé & Príncipe dobra | São Tomé and Príncipe Dobras | São Tomé & Príncipe dobras | «and», not «&», in words |
TJS | Tajikistani Somoni | Tajikistani somoni | Tajikistani Somoni | Tajikistani somonis | no plural form in the currency's own language |
TMT | Turkmenistan Manat | Turkmenistani manat | Turkmenistan Manat | Turkmenistani manat | ISO 4217: Turkmenistan New Manat |
TOP | Tongan Pa'anga | Tongan paʻanga | Tongan Pa'anga | Tongan paʻanga | the apostrophe of ISO 4217 (Pa’anga), which any keyboard types |
TTD | Trinidad and Tobago Dollar | Trinidad & Tobago dollar | Trinidad and Tobago Dollars | Trinidad & Tobago dollars | «and», not «&», in words (ISO 4217) |
VED | Venezuelan Bolívar Digital | Bolívar Soberano | Venezuelan Bolívares Digitales | Bolívar Soberanos | the digital bolívar of 2021, with the Spanish plural |
VES | Venezuelan Bolívar | Venezuelan bolívar | Venezuelan Bolívares | Venezuelan bolívars | the Spanish plural, bolívares |
VUV | Vanuatu Vatu | Vanuatu vatu | Vanuatu Vatu | Vanuatu vatus | no plural form in the currency's own language (CLDR's British English agrees) |
ZMW | Zambian Kwacha | Zambian kwacha | Zambian Kwacha | Zambian kwachas | kwacha, unchanged, as written in Zambia |
ZWG | Zimbabwe Gold | Zimbabwean gold | Zimbabwe Gold | Zimbabwean gold | the ISO 4217 name, Zimbabwe Gold |
ZWL | Zimbabwean Dollar | Zimbabwean dollar (2009–2024) | Zimbabwean Dollars | Zimbabwean dollars (2009–2024) | CLDR adds the years of a withdrawn currency |
To write a currency another way, give its names with registerCurrency(), or name it in the call, e.g. arqam("3", "en-US", {style: "currency", demonym: "Nigerian", major: "Naira", majorPl: "Nairas", minor: "Kobo", minorPl: "Kobo"}).
arqam("3", "en-US", {currency: "NGN"})arqam("3", "en-US", {currency: "BRL"})Q14What does it give for text that is not a number?Advanced
The isNaN option (default ""); it never throws for a bad number.
arqam("12,5", "en-US")arqam("abc", "en-US", {isNaN: "not a number"})