mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Various improvements
This commit is contained in:
@@ -46,11 +46,6 @@ public func formatTonAmountText(_ value: Int64, dateTimeFormat: PresentationDate
|
||||
break
|
||||
}
|
||||
}
|
||||
if value < 0 {
|
||||
balanceText.insert("-", at: balanceText.startIndex)
|
||||
} else if showPlus {
|
||||
balanceText.insert("+", at: balanceText.startIndex)
|
||||
}
|
||||
|
||||
if let dotIndex = balanceText.range(of: dateTimeFormat.decimalSeparator) {
|
||||
balanceText = String(balanceText[balanceText.startIndex ..< min(balanceText.endIndex, balanceText.index(dotIndex.upperBound, offsetBy: 2))])
|
||||
@@ -59,12 +54,22 @@ public func formatTonAmountText(_ value: Int64, dateTimeFormat: PresentationDate
|
||||
if let integerPart = Int32(integerPartString) {
|
||||
let modifiedIntegerPart = presentationStringsFormattedNumber(integerPart, dateTimeFormat.groupingSeparator)
|
||||
|
||||
let resultString = "\(modifiedIntegerPart)\(balanceText[dotIndex.lowerBound...])"
|
||||
var resultString = "\(modifiedIntegerPart)\(balanceText[dotIndex.lowerBound...])"
|
||||
if value < 0 {
|
||||
resultString.insert("-", at: resultString.startIndex)
|
||||
} else if showPlus {
|
||||
resultString.insert("+", at: resultString.startIndex)
|
||||
}
|
||||
return resultString
|
||||
}
|
||||
} else if let integerPart = Int32(balanceText) {
|
||||
balanceText = presentationStringsFormattedNumber(integerPart, dateTimeFormat.groupingSeparator)
|
||||
}
|
||||
if value < 0 {
|
||||
balanceText.insert("-", at: balanceText.startIndex)
|
||||
} else if showPlus {
|
||||
balanceText.insert("+", at: balanceText.startIndex)
|
||||
}
|
||||
|
||||
return balanceText
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user