Skip to main content
Solved

How to format phone number

  • June 19, 2020
  • 1 reply
  • 60 views

rich90599
Contributor
Forum|alt.badge.img+4
Hello,

I have a 10 digit phone number in an attribute (e.g. 0123456789).

However, I want to output it formatted to a string like this: 012-345-6789.

How would I go about doing this?

Any help would be much appreciated.

Thanks

Best answer by ebygomm

Take 3 from the left, add a hyphen, 3 from the middle add a hyphen, 4 from the right

@Left(@Value(phone),3)-@Substring(@Value(phone),3,3)-@Right(@Value(phone),4)
View original
Did this help you find an answer to your question?

1 reply

ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • Best Answer
  • June 19, 2020

Take 3 from the left, add a hyphen, 3 from the middle add a hyphen, 4 from the right

@Left(@Value(phone),3)-@Substring(@Value(phone),3,3)-@Right(@Value(phone),4)

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings