Skip to contents

methods for generating phone numbers

Super class

charlatan::BaseProvider -> PhoneNumberProvider

Public fields

locale

(character) the locale

formats

phone number formats

area_code_formats

area code formats

Methods

Inherited methods


Method allowed_locales()

fetch the allowed locales for this provider

Usage

PhoneNumberProvider$allowed_locales()


Method new()

Create a new PhoneNumberProvider object

Usage

PhoneNumberProvider$new(locale = NULL)

Arguments

locale

(character) the locale to use. See $allowed_locales() for locales supported (default: en_US)

Returns

A new PhoneNumberProvider object


Method render()

Make a phone number

Usage

PhoneNumberProvider$render()


Method clone()

The objects of this class are cloneable with this method.

Usage

PhoneNumberProvider$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

z <- PhoneNumberProvider$new()
z$render()
#> [1] "1-795-338-7173x550"

PhoneNumberProvider$new(locale = "fr_FR")$render()
#> [1] "01 92 52 44 84"
PhoneNumberProvider$new(locale = "sk_SK")$render()
#> [1] "+421 2 57817586"

# locales with area codes
PhoneNumberProvider$new(locale = "en_AU")$render()
#> [1] "(07) 8782 7091"
PhoneNumberProvider$new(locale = "en_NZ")$render()
#> [1] "+64 29 370 9633"
PhoneNumberProvider$new(locale = "es_PE")$render()
#> [1] "0-63-957900"