我想将此输入的格式更改为货币格式
<TextInput name="Amount" type="Text"
floatingLabelText={messages.AMOUNT[lang]}
errorText={err.Amount}
value={} onChange={this.handleChange} required
/>
答案 0 :(得分:1)
您需要以下方法:
const priceSplitter = (number) => (number && number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','));
console.log(priceSplitter(72500));