Article 5NB29 Ask Slashdot: Is There a 'Standard' Way of Formatting Numbers?

Ask Slashdot: Is There a 'Standard' Way of Formatting Numbers?

by
EditorDavid
from Slashdot on (#5NB29)
Long-time Slashdot reader Pieroxy is working on a new open source project, a web-based version of the system-monitoring software Conky. The ultimate goal is send the data to an HTML interface "to find some use for the old iPads/tablets/laptops we all have lying around. You can put them next to your screen and have your metrics displayed there...!" There's just one problem: "I had to come up with a way for users to format a number."I needed a small string the user could write to describe exactly what they want to do with their number. Some examples can be: write it as a 3-digit number suffixed by SI prefixes when the numbers are too big or too small, display a timestamp as HH:MM string, or just the day of week, eventually cut to the first three characters, do the same with a timestamp in milliseconds, or nanoseconds, display a nice string out of a number of seconds to express a duration ("3h 12mn 17s"), pad the number with spaces so that all numbers are aligned (left or right), force a fixed number of digits after the decimal point, etc. In other words, I was looking for a "universal" way of formatting numbers and failed to find any kind of standard online. Do Slashdot readers know of such a thing or should I create my own?

twitter_icon_large.pngfacebook_icon_large.png

Read more of this story at Slashdot.

External Content
Source RSS or Atom Feed
Feed Location https://rss.slashdot.org/Slashdot/slashdotMain
Feed Title Slashdot
Feed Link https://slashdot.org/
Feed Copyright Copyright Slashdot Media. All Rights Reserved.
Reply 0 comments