Domino Code Fragment

Code Name*
Phone Number Input Translation
Date*
04/29/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.18.222.69.152
Description*
This formula will take any US phone number in any format, and change it to (###) ###-#### format.
Type*
Formula
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
NewPhone := @Trim(@Implode(@Explode(Phone;"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ?!@#$%^&*_+=[]{}|\"<>,.\';:()/\\- ";0);""));
@If(@Length(NewPhone)=11 & (@Left(NewPhone;1)="1" | @Left(NewPhone;1)="0");
@Return(@Left(NewPhone;1) + " (" + @Middle(NewPhone;1;3) + ")" +
@Middle(NewPhone;4;3) + "-" + @Right(NewPhone;4));
@Length(NewPhone)=10;
@Return("(" + @Left(NewPhone;3) + ") " + @Middle(NewPhone;3;3) + "-" + @Right(NewPhone;4));
@Length(NewPhone)=7;
@Return(@Left(NewPhone;3) + "-" + @Right(NewPhone;4));
@Do(
@Prompt([OK];"Unrecognizable Phone Number";"Unable to interpret Phone Number");
@Return(Phone)
)
)