ng:spellOutNumber(number,locale)
The built-in XPath function, ng:spellOutNumber can help you to spell out a number as text.
The output text is as-is and might not fit the exact way to write the amount of a text in any locale, but you can e.g. replace texts with the replace XPath function.
The function accepts two parameters:
number
This is the number (or amount), that you want to output spelled out.
locale
This is the identification of the output language. This must be the full locale e.g. en-US, de-DE etc.
Examples:
Function | Outputs |
---|---|
ng:spellOutNumber(123,'en-GB') | one hundred twenty-three |
ng:spellOutNumber(11123.45,'en-GB') | eleven thousand one hundred twenty-three point four five |
ng:spellOutNumber(123,'de-DE') | einhundertdreiundzwanzig |
ng:spellOutNumber(123,'dk-DK') | hundrede og treogtyve |