Post

1 follower Follow
0
Avatar

HELP! I need to format a phone number

I have a text field with a phone number formatted like "+17045555555". I have a calculation that strips "+1" from the beginning of the text string and results with "7045555555" using this code

'[var text = @From Number
    text.substr(text.lastIndexOf("+") + 2)]'

I now need to take that result and add hyphens to format like "704-555-5555".  How can I add to or edit this code to add hyphens in the proper places?  Any help is GREATLY appreciated!

Justin Stewart Bell

Please sign in to leave a comment.