This is my first attempt to make an ios app.
I\'m using people picker to ask the user for a phone number, but when it retrieves with the code below, my NSStrin
NSStrin
SWIFT 5.0 solution
let purePhoneNumber = phoneNumber.replacingOccurrences(of: "[^0-9]", with: "", options: .regularExpression)
If you want to leave + sign in string, you can use regexp [^0-9+].
+
[^0-9+]