Last active
September 20, 2019 14:09
-
-
Save jhonsore/f048b222aa0b723d648e8160e397235e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const strPtBrMoneyToNumber = value => { | |
| if(!value){ | |
| console.warn('strPtBrMoneyToNumber needs a value to be converted'); | |
| return false; | |
| } | |
| value = String(value); | |
| value = value.replace(/\./g, '#');//remove . e troca por # | |
| value = value.replace(/,/g, '.');//remove a , e muda para . | |
| value = value.replace(/#/g, '');//remove a # e muda para "" | |
| return value; | |
| } | |
| console.log('1.000,99'); | |
| console.log(100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment