标签: swift string
我有一个电话号码 String,格式如下:+1 (123) 456-7890,我希望将其更改为:1234567890。我该怎么做?我尝试了下面的代码,但它仍然显示相同的格式。
String
let phone = phoneNumber.text?.replacingOccurrences(of: "[()\\s-]+", with: "", options: .literal, range: nil) print("phone Number \(phone)")