mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Wallet send & receive screens
This commit is contained in:
17
submodules/TextFormat/Sources/StringPadding.swift
Normal file
17
submodules/TextFormat/Sources/StringPadding.swift
Normal file
@@ -0,0 +1,17 @@
|
||||
import Foundation
|
||||
|
||||
public extension String {
|
||||
func rightJustified(width: Int, pad: String = " ", truncate: Bool = false) -> String {
|
||||
guard width > count else {
|
||||
return truncate ? String(suffix(width)) : self
|
||||
}
|
||||
return String(repeating: pad, count: width - count) + self
|
||||
}
|
||||
|
||||
func leftJustified(width: Int, pad: String = " ", truncate: Bool = false) -> String {
|
||||
guard width > count else {
|
||||
return truncate ? String(prefix(width)) : self
|
||||
}
|
||||
return self + String(repeating: pad, count: width - count)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user