正則 js分轉元帶千分符號

可以通過縮放來進行分到元的轉換,同時使用正則對處理後的數字進行千分位格式化 方法1:(不丟失精度) function Fen2Yuan( num ) { if ( typeof num !== "number" || isNaN( num ) ) return null; return ( num / 100 ).toFixed( 2 ); }function Fen2Yuan( num ) {
相關文章
相關標籤/搜索