Fix negative number formatting

This commit is contained in:
Ilya Laktyushin 2025-04-08 20:07:07 +04:00
parent 2ab4af656b
commit 732a430119

View File

@ -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 {