META-INF.resources.bower_components.globalize.src.number.format.grouping-separator.min.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jwebmp-globalize Show documentation
Show all versions of jwebmp-globalize Show documentation
The JWebSwing implementation for a full Globalization
define(function(){return function(number,primaryGroupingSize,secondaryGroupingSize){var index,currentGroupingSize=primaryGroupingSize,ret="",sep=",",switchToSecondary=secondaryGroupingSize?true:false;number=String(number).split(".");index=number[0].length;while(index>currentGroupingSize){ret=number[0].slice(index-currentGroupingSize,index)+(ret.length?sep:"")+ret;index-=currentGroupingSize;if(switchToSecondary){currentGroupingSize=secondaryGroupingSize;switchToSecondary=false}}number[0]=number[0].slice(0,index)+(ret.length?sep:"")+ret;return number.join(".")}});