<u><b>num2CommaNum(number)</b></u>
Have you ever wanted to display big numbers clearly in your games? Then use this process.
<u><b>Example</b></u>
<dm>
world << "[num2CommaNum(1482428)]"
Outputs: 1,482,428
world << "[num2CommaNum(148242.8)]"
Outputs: 148,242.8
Code
// Author: Hiead | Editor: Zecronious
// Date: 25/04/2013
//-------------------
proc
num2commaNum(theNum, sigFig = 7) // default sigFig (1,000,000)
var/finalNum = num2text(theNum, sigFig)
// Start from the end, or from the decimal point
var/end = findtextEx(finalNum, ".") || length(finalNum) + 1
// Moving towards start of string, insert comma every 3 characters
for(var/pos = end - 3, pos > 1, pos -= 3)
finalNum = copytext(finalNum, 1, pos) + "," + copytext(finalNum, pos)
return finalNum