Jun 9, 2017
取得尾數 0 的個數
/** * 取得尾巴帶幾個 0 */ private getZeroLength(num: number): number { let count = 0; if (num % 10 == 0) { count++; count += this.getZeroLength(num / 10); } return count; }
this.getZeroLength(158000000000); //9 this.getZeroLength(205000); //3












