Formatting numbers (decimal separator)

The standard format for the decimal separator in a number appears to be a dot (33612.13). Is it maybe possible to format a number to show it with a comma as a decimal separator (33612,13)?

Ward

Hi Warde

You can use the currency filter (https://developer.silverfin.com/docs/number-filters#currency) to format numbers, then the decimal separator will be set to what is standard in that language. So if your language in Silverfin is Dutch, French or Danish, then it’ll use a comma as a decimal separator.

Kind regards
Wouter

Ok, tx, I do know about that Wouter, but the problem is that I really want “33612,13” as a number, and with the currency format, I get “33.612,13”.

Ok, then you should be able to achieve this by using the replace filter, for example:

{{ 5*5.25  | replace:".","," }}

will then output 26,25

However, do bear in mind that this will convert your number into a string, so I would only do the replace on the end of the calculation or when you’re printing the value. Calculating further with the number after the replace will have a chance of giving you incorrect results.

Kind regards
Wouter

Ok, great, tx, this might do the job. The numbers need this format to be uploaded in another program, but not sure if a string will be recognised… Let’s try.