Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erro no tonumber #2

Closed
guilhermegregio opened this issue Jul 13, 2017 · 0 comments
Closed

Erro no tonumber #2

guilhermegregio opened this issue Jul 13, 2017 · 0 comments

Comments

@guilhermegregio
Copy link
Contributor

A expressão tonumber esta se comportando de forma incorreta exemplo:

tonumber('11.750,80|d') // => 11.750

O correto seria 11750.80

Também não existe forma de mudar a precisão de casas decimais e tem problema para formatos diferentes de valores por exemplo valores brasileiro ou americano.

Talvez uma forma interessante de utilização seria assim:
tonumber('VALOR|PRECISAO|FORMATO')

tonumber('1234.123.123,56|f:2|BRL')

VALOR: 11.760,00
PRECISAO: f:2
FORMATO: BRL

guilhermegregio added a commit to guilhermegregio/walnutjs that referenced this issue Jul 13, 2017
guilhermegregio added a commit to guilhermegregio/walnutjs that referenced this issue Jul 18, 2017
mmendesas added a commit that referenced this issue Jul 18, 2017
Improved tonumber reported in issue #2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants