mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix negative number formatting
This commit is contained in:
parent
2ab4af656b
commit
732a430119
@ -26,6 +26,9 @@ public func presentationStringsFormattedNumber(_ count: Int32, _ groupingSeparat
|
||||
let string = "\(count)"
|
||||
if groupingSeparator.isEmpty || abs(count) < 1000 {
|
||||
return string
|
||||
} else {
|
||||
if count < 0 {
|
||||
return "-\(presentationStringsFormattedNumber(abs(count), groupingSeparator))"
|
||||
} else {
|
||||
var groupedString: String = ""
|
||||
for i in 0 ..< Int(ceil(Double(string.count) / 3.0)) {
|
||||
@ -37,6 +40,7 @@ public func presentationStringsFormattedNumber(_ count: Int32, _ groupingSeparat
|
||||
}
|
||||
return groupedString
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func presentationStringsFormattedNumber(_ starsAmount: StarsAmount, _ groupingSeparator: String = "") -> String {
|
||||
|
Loading…
x
Reference in New Issue
Block a user