前言 为了获得一堆apk的大小,并与人类友好方式显示.本来是打算用以下方法,到时不能具体到保留两位小数. org.apache.commons.io.FileUtils.byteCountToDisplaySize(f.length()); Returns a human-readable version of the file size, where the input represents a specific number of bytes. If the size is over 1GB
js保留两位小数四舍五入: (Math.floor(until_price*100)/100).toFixed(2);//会四舍五入 保留两位小数 且不四舍五入(三种方式,请用最后一种): var num="2.999999999"; num = Number(num); num*=100; num = (Math.floor(num)/100).toFixed(2); alert(num); var a = "2.999999999"; a = a-0; a*
换行的字符串 "This string\nhas two lines" 字符串中使用单引号时应该怎么写 'You\'re right, it can\'t be a quote' 把数字变成字符串并保留两位小数 var n = 123456.789 n.toFixed(0); //"123457" n.toFixed(2); //"123456.79" parseFloat(str)str以非数字开头,则返回NaN parseFloat(str)