mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-17 19:09:56 +00:00
14 lines
379 B
Swift
14 lines
379 B
Swift
import Foundation
|
|
import TelegramCorePrivateModule
|
|
|
|
private let phoneNumberUtil = NBPhoneNumberUtil()
|
|
|
|
public func formatPhoneNumber(_ string: String) -> String {
|
|
do {
|
|
let number = try phoneNumberUtil.parse("+" + string, defaultRegion: nil)
|
|
return try phoneNumberUtil.format(number, numberFormat: .INTERNATIONAL)
|
|
} catch _ {
|
|
return string
|
|
}
|
|
}
|