1function number_format (number, decimals, dec_point, thousands_sep) { 2 // From: http://phpjs.org/functions 3 // + original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com) 4 // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) 5 // + bugfix by: Michael White (http://getsprink.com) 6 // + bugfix by: Benjamin Lupton 7 // + bugfix by: Allan Jensen (http://www.winternet.no) 8 // + revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com) 9 // + bugfix by: Howard Yeend 10 // + revised by: Luke Smith (http://lucassmith.name) 11 // + bugfix by: Diogo Resende 12 // + bugfix by: Rival 13 // + input by: Kheang Hok Chin (http://www.distantia.ca/) 14 // + improved by: davook 15 // + improved by: Brett Zamir (http://brett-zamir.me) 16 // + input by: Jay Klehr 17 // + improved by: Brett Zamir (http://brett-zamir.me) 18 // + input by: Amir Habibi (http://www.residence-mixte.com/) 19 // + bugfix by: Brett Zamir (http://brett-zamir.me) 20 // + improved by: Theriault 21 // + input by: Amirouche 22 // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) 23 // * example 1: number_format(1234.56); 24 // * returns 1: '1,235' 25 // * example 2: number_format(1234.56, 2, ',', ' '); 26 // * returns 2: '1 234,56' 27 // * example 3: number_format(1234.5678, 2, '.', ''); 28 // * returns 3: '1234.57' 29 // * example 4: number_format(67, 2, ',', '.'); 30 // * returns 4: '67,00' 31 // * example 5: number_format(1000); 32 // * returns 5: '1,000' 33 // * example 6: number_format(67.311, 2); 34 // * returns 6: '67.31' 35 // * example 7: number_format(1000.55, 1); 36 // * returns 7: '1,000.6' 37 // * example 8: number_format(67000, 5, ',', '.'); 38 // * returns 8: '67.000,00000' 39 // * example 9: number_format(0.9, 0); 40 // * returns 9: '1' 41 // * example 10: number_format('1.20', 2); 42 // * returns 10: '1.20' 43 // * example 11: number_format('1.20', 4); 44 // * returns 11: '1.2000' 45 // * example 12: number_format('1.2000', 3); 46 // * returns 12: '1.200' 47 // * example 13: number_format('1 000,50', 2, '.', ' '); 48 // * returns 13: '100 050.00' 49 // Strip all characters but numerical ones. 50 number = (number + '').replace(/[^0-9+\-Ee.]/g, ''); 51 var n = !isFinite(+number) ? 0 : +number, 52 prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), 53 sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, 54 dec = (typeof dec_point === 'undefined') ? '.' : dec_point, 55 s = '', 56 toFixedFix = function (n, prec) { 57 var k = Math.pow(10, prec); 58 return '' + Math.round(n * k) / k; 59 }; 60 // Fix for IE parseFloat(0.55).toFixed(0) = 0; 61 s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.'); 62 if (s[0].length > 3) { 63 s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); 64 } 65 if ((s[1] || '').length < prec) { 66 s[1] = s[1] || ''; 67 s[1] += new Array(prec - s[1].length + 1).join('0'); 68 } 69 return s.join(dec); 70}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.