亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

How to properly format numbers on <TextInput> on the fly in React Native?
P粉396248578
P粉396248578 2023-09-11 13:24:19
0
1
682

<TextInput value={initialMoney} 
    onChangeText={(x) => {
      setInitialMoney(x.replace(/\B(?=(\d{3})+(?!\d))/g, '.'));
    }}
/>

The above code will not work properly.

instead of showing 214.124.124.124

It will show 2.1.4.1.2.4.1.2.4.123

No problem with regex, I tried regex outside of TextInput and it worked fine. Can anyone help me solve this problem?

P粉396248578
P粉396248578

reply all(1)
P粉724256860

There may be some problems with your regular expression. Trying to debug it, I checked via Regex101 and it showed the error.

Try reading this articleHow to format numbers to currency when using React Native Expo?

Hope this helps.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template