Skip to main content
System
Phone (integer)
int64
code reference

Definition

The phone transformer can anonymize an existing phone number or completely generate a new one. There are two phone number transformers that differ by type and the configurations that are available to customize the transformer. This transformer specifically takes an integer value and returns an integer value. The Phone (string) transformer takes in a string value, returns a string and has more configurations available.

By default, the phone (integer) transformer generates a random 10 digit phone number.

For example, the following input value: 7829828714

Would produce the following ouput value: 5698437232

You can see we generated a new phone integer value that can be used as an integer phone number. Also, note that we don't include hyphens in this transformer since the output type is an integer.

Phone numbers also vary in length with some international phone numbers reaching up to 15 digits in length. You can set this transformer to respect the length of the input value if you're working with phone numbers longer than 10 digits in length.

Configurations

Depending on your validations, you may want to configure the output phone number. As we discussed above, some phone numbers may be longer than the default 10 digits in length. The phone number (integer) transformer has the following configurations:

NameDescriptionDefaultExample InputExample Output
PreserveLengthPreserve Length will ensure that the output phone number is the same length as the input phone number.false892387243786243290374867526392

Examples

There are several ways you can mix-and-match configurations to get different potential phone number formats. Here are some possible combinations:

PreserveLengthExample InputExample Output
false28909237845209273239
true839304957362916395745371