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