change digits function to use unicode 'thin space' as thousands seperator

This commit is contained in:
Jon Atkins 2013-12-18 22:41:55 +00:00
parent 2419868f54
commit ba33e28675

View File

@ -122,7 +122,9 @@ window.convertCookieToLocalStorage = function(name) {
// add thousand separators to given number.
// http://stackoverflow.com/a/1990590/1684530 by Doug Neiner.
window.digits = function(d) {
return (d+"").replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1 ");
// U+2009 - Thin Space. Recommended for use as a thousands separator...
// https://en.wikipedia.org/wiki/Space_(punctuation)#Table_of_spaces
return (d+"").replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1 ");
}