代码 /** * 大数字转换,将大额数字转换为万.千万.亿等 * @param value 数字值 */ export function bigNumberTransform (value) { const newValue = ['', '', ''] let fr = 1000 let num = 3 let text1 = '' let fm = 1 while (value / fr >= 1) { fr *= 10 num += 1 // console.log('数字', value
js处理数值和日期本地化 const s = new Intl.NumberFormat('zh-cn'); s.format(111.111) // "111.111" const s = new Intl.NumberFormat('zh-cn', {style: 'currency', currency: 'CNY'}); s.format(111.111) // "¥111.11" const s = new Intl.DateTimeFormat('zh-
function DX(n) { if (!/^(0|[1-9]\d*)(\.\d+)?$/.test(n)) return "数据非法"; var unit = "千百拾亿千百拾万千百拾元角分", str = ""; n += "00"; var p = n.indexOf('.'); if (p >= 0
求一个数两位数的个位数,十位数,百位数及千位: int num = 53; int g = (num / 1) % 10; //个位 int s = (num / 10) % 10; //十位 int b = (num / 100) % 10; //百位 int b = (num / 1000) % 10; //千位 你会发现,这是有规律的,求哪一位就用这个数除以位的值,然后再对10进行求余.如果不求余那就会出现高位的数,例如,如果不对百位求余,当你输入一个四位数(3456),