From http://stackoverflow.com/questions/6458990/how-to-format-a-number-1000-as-1-000.