mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
no message
This commit is contained in:
22
TelegramUI/NumericFormat.swift
Normal file
22
TelegramUI/NumericFormat.swift
Normal file
@@ -0,0 +1,22 @@
|
||||
import Foundation
|
||||
|
||||
public func compactNumericCountString(_ count: Int) -> String {
|
||||
if count >= 1000 * 1000 {
|
||||
let remainder = (count % (1000 * 1000)) / (1000 * 100)
|
||||
if remainder != 0 {
|
||||
return "\(count / (1000 * 1000)),\(remainder)M"
|
||||
} else {
|
||||
return "\(count / (1000 * 1000))M"
|
||||
}
|
||||
} else if count >= 1000 {
|
||||
let remainder = (count % (1000)) / (100)
|
||||
if remainder != 0 {
|
||||
return "\(count / 1000),\(remainder)K"
|
||||
} else {
|
||||
return "\(count / 1000)K"
|
||||
}
|
||||
} else {
|
||||
return "\(count)"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user