question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to output number with fixed decimals and with comma instead of period?

See original GitHub issue

I am outputing some numbers that needs to be rounded to the first decimal. I am using:

 round(num*10)/10;

which gives me 1, 1.1, 1.2 ...

I need to print the 1 also as 1.0.

Is there an elegant way to do this with CindyJS? In JS it is tofixed().


Furthermore, is there a way to output `4,1` instead of `4.1`?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
montagacommented, Dec 17, 2018

In my opinion, the nicest would be to have a modifier for the format command (https://cindyjs.org/ref/String_Operators.html#format$2) that just does this.

As a workaround, you could build your own format function similar to the function fmt in https://cindyjs.org/examples/81_Clock.html

0reactions
q2aprocommented, Jul 9, 2019

When is the implementation planned? It would be great to have x,y already in production mode 😃 For now it’s still period which might confuse some young students that got used to comma in school.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change comma to period as default decimal separator
This should be simple. I want Windows 10 to treat my numpad decimal separator as a period, instead of comma (danish default).
Read more >
Convert Floating Point Number to String Using a Comma or ...
Choose your decimal point (comma or period), then click on Add New Operation. Choose how you want to format the number from the...
Read more >
Decimal Points: Periods or Commas? | Proofed's Writing Tips
Periods or commas for decimal markers? Both are used as decimal markers and this guide will tell you which you should be using....
Read more >
How to Convert Comma to Decimal Point & Dot to ... - YouTube
Download the featured file here https://www.bluepecantraining.com/how-to-convert- comma -to- decimal -point- dot -to- comma -in-excel/In this video ...
Read more >
How to Change Commas to Decimal Points and Vice Versa in ...
Depending on your country or region, Excel may display decimal points or dots instead of commas for larger numbers. The decimal point (.)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found