Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

beauty Format for BigUInt number In String Format #200

Closed
MrShafiee opened this issue Jul 30, 2018 · 1 comment
Closed

beauty Format for BigUInt number In String Format #200

MrShafiee opened this issue Jul 30, 2018 · 1 comment

Comments

@MrShafiee
Copy link

Hi @shamatar,
When I want to show BigUInt value in String format, I use formatToEthereumUnits function on Web3+Utils.swift, It work correctly but there is a problem, we should set manually the decimals value and usually we don't know the number of digit on it.

for example when we got wallet balance, its value is 220000000000000 in wei and if we want convert in to .eth we should specific the decimals manually, if we set 18 it return 0.000220000000000000
if we set 4 it returns 0.0002 how we can omit 0 digit at the end of the balance automatically.

Is there any function to do this? (omit the zero number at the end of the balance)

@shamatar
Copy link
Contributor

Hello @MrShafiee

No, the existing function can no do it, you should use some standard Swift functionality to do it. If at some point you make a nice function that you think should be used for everyone - just submit a PR.

Sincerely, Alex

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants