1. 程式人生 > >jq中金額分和元的轉換

jq中金額分和元的轉換

分轉換為元,無小數點
const str = (totalPayFee/100).toFixed(2) + '';
const intSum = str.substring(0,str.indexOf(".")).replace( /\B(?=(?:\d{3})+$)/g, ',' );
元轉換為分

 

num=num*100;//元到分