File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
BDKSwiftExampleWallet/Extensions Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,16 @@ extension UInt64 {
3434}
3535
3636extension UInt64 {
37+ private var numberFormatter : NumberFormatter {
38+ let numberFormatter = NumberFormatter ( )
39+ numberFormatter. numberStyle = . decimal
40+ numberFormatter. usesGroupingSeparator = true
41+ numberFormatter. groupingSeparator = " , "
42+ numberFormatter. generatesDecimalNumbers = false
43+
44+ return numberFormatter
45+ }
46+
3747 func formattedSatoshis( ) -> String {
3848 if self == 0 {
3949 return " 0.00 000 000 "
@@ -62,16 +72,11 @@ extension UInt64 {
6272 func formattedBip177( ) -> String {
6373 if self >= 1_000_000 && self % 1_000_000 == . zero {
6474 return " \( self / 1_000_000 ) M "
75+
6576 } else if self % 1_000 == 0 {
6677 return " \( self / 1_000 ) K "
6778 }
6879
69- let numberFormatter = NumberFormatter ( )
70- numberFormatter. numberStyle = . decimal
71- numberFormatter. usesGroupingSeparator = true
72- numberFormatter. groupingSeparator = " , "
73- numberFormatter. generatesDecimalNumbers = false
74-
7580 return numberFormatter. string ( from: NSNumber ( value: self ) ) ?? " 0 "
7681 }
7782}
You can’t perform that action at this time.
0 commit comments