js prototype 格式化数字 By shawl.qiu

2019-06-03 00:29:18王旭

            var re=new RegExp('(.{'+pointPsti+'})','g');  
                temp=temp.replace(re,'$1,'); num='';                  
            for(var i=temp.length-1; i>=0; num+=temp.substr(i,1), i--);  
                num=num.replace(/^,|,$/,'')+numDc;  
            return num; // shawl.qiu script  
        }  
            Response.Write($num.formatNumber(3)+'<br/>');  
%> 

2. 效率测试

输出 10,000 次, 耗时 2797 毫秒. 
输出 5,000 次, 耗时 1515 毫秒. 
输出 2,000 次, 耗时 672 毫秒. 
输出 1,000 次, 耗时 281 毫秒. 
输出 500 次, 耗时 140 毫秒. 
输出 100 次, 耗时 16 毫秒.