mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Merge commit '55953feeb1'
This commit is contained in:
commit
2387dbd1ad
1 changed files with 11 additions and 7 deletions
|
|
@ -27,15 +27,19 @@ public func presentationStringsFormattedNumber(_ count: Int32, _ groupingSeparat
|
|||
if groupingSeparator.isEmpty || abs(count) < 1000 {
|
||||
return string
|
||||
} else {
|
||||
var groupedString: String = ""
|
||||
for i in 0 ..< Int(ceil(Double(string.count) / 3.0)) {
|
||||
let index = string.count - Int(i + 1) * 3
|
||||
if !groupedString.isEmpty {
|
||||
groupedString = groupingSeparator + groupedString
|
||||
if count < 0 {
|
||||
return "-\(presentationStringsFormattedNumber(abs(count), groupingSeparator))"
|
||||
} else {
|
||||
var groupedString: String = ""
|
||||
for i in 0 ..< Int(ceil(Double(string.count) / 3.0)) {
|
||||
let index = string.count - Int(i + 1) * 3
|
||||
if !groupedString.isEmpty {
|
||||
groupedString = groupingSeparator + groupedString
|
||||
}
|
||||
groupedString = String(string[string.index(string.startIndex, offsetBy: max(0, index)) ..< string.index(string.startIndex, offsetBy: index + 3)]) + groupedString
|
||||
}
|
||||
groupedString = String(string[string.index(string.startIndex, offsetBy: max(0, index)) ..< string.index(string.startIndex, offsetBy: index + 3)]) + groupedString
|
||||
return groupedString
|
||||
}
|
||||
return groupedString
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue