Seperate large numbers with comma

How do I format a number such that it has a comma in every thousand position (both integers and floating values?)

For example 1000000.35 will be 1000,000.35?

You can use the `ToString()` function of the variable like this:

var num : float = 1000000.35;
Debug.Log(num.ToString("n2"));

Where `n` is for `number` and 2 is the number of decimal places you want to display. If you don't want to use the comma use `f` (`float`) instead.

To complement Lipis' answer:

The version of Mono (which is a version of .net) in Unity comes with a wealth of built-in formatting options, so you can use the MSDN reference to look this sort of thing up:

For more information see the MSDN documentation on "N" formatting:

http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx#NFormatString

And on standard number formatting in general:

http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx

And on applying custom formats to your number strings:

http://msdn.microsoft.com/en-us/library/0c899ak8%28v=VS.90%29.aspx