money counter with thousand separators?

Hi there. I have this script:

var money = 0.0;
var moneyFormatted = String.Format("{0:#,###0}", money);


GetComponent(TextMesh).text = "竄ャ" + moneyFormatted;
var increase = 336;

     
function Start () {
InvokeRepeating("AddToMoney", 1.0, 1.0);
}
     
function AddToMoney () {
money += increase;


//guiText.text = "Money wasted: €" + money;
GetComponent(TextMesh).text = "€" + money;
}

Probably very easy, I’m not much of a coder. BUT, this money number will get real high in a few hours, so it would be really nice if I could have something within the script that makes sure that 45234531 looks like 45.234.531. Can anyone of you please help me out?

thanks in advance

grts dmvd

Check out this page for some format specifiers for the String.Format method. The one you seek is among them.

If someone stumble over this old post and like me are using the .ToString() method.
You can use this -
money.ToString(“n0”);
See this answer