Advertisement:

How to shorten numbers across the forum to K/M/B?

Aloittaja Biology Forums, elokuu 05, 2014, 02:21:35 IP

« edellinen - seuraava »

Biology Forums


1372 -> 1.3 K
2023150 -> 2 M
5430120215 -> 5.4 B


I found this solution: http://stackoverflow.com/questions/4371059/shorten-long-numbers-to-k-m-b/4371114#4371114

How could I incorporate that into SMF?

Matthew K.

As I mentioned on Google Chat - in case anyone else is interested in the answer that I provided. You would need to specify where exactly you would want to incorporate this, there isn't a viable method to convert all numbers into formats as such.

Arantor

Because comma_format totally isn't a thing that would be the ideal place to do this.
Holder of controversial views, all of which my own.


margarett

Tricky...
It depends really on where that comes from. Inside posts should be difficult, maybe using a custom BBC for it, but that also requires you to add BBC tags around the numbers you want to "shorten".
Outside the posts you can hack "function comma_format" --> Subs.php but I can't really tell if this is used everywhere...

edit: ninja'd :P
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Arantor

It's used everywhere that's actually important because it's what also does number formatting, in a manner that doesn't depend on setlocale settings.
Holder of controversial views, all of which my own.


Biology Forums

So, can this be done via the comma_format function?

Arantor

Holder of controversial views, all of which my own.


Advertisement: