Skip to contents

Strip phone number of all non-numeric characters and add country code. Used to format phone numbers properly for use with the tel:// HTML attribute's protocol.

Usage

strip_phone_number(phone)

Arguments

phone

String representing a phone number.

Value

Formatted string of the phone number.

Examples

strip_phone_number("(555) 555-5555")
#> [1] "+15555555555"
strip_phone_number("555-555-5555")
#> [1] "+15555555555"
strip_phone_number("555.555.5555")
#> [1] "+15555555555"