AnsweredAssumed Answered

Format text field for UK telephone numbers

Question asked by scottlynch on Mar 15, 2011
Latest reply on Mar 15, 2011 by scottlynch

Title

Format text field for UK telephone numbers

Post

Hi All,

I'm trying to format a telephone number text field to UK format  i.e. 01234 567-890. I've research this forum and other websites and have come up with the calculation below. 

 

 Let ( [ num = Filter ( Self ; "0123456789" ) ] ; Case ( Length ( num ) = 11 ; "" & Left ( num ; 5 ) & " " & Middle ( num ; 6 ; 3 ) & "-" & Right ( num ; 3 ) ; Self ) )

 

It all works fine and does exactly what I want. But I want to understand why it works. 

 

I guess that  "Case ( Length ( num ) = 11" means eleven numbers, and "Left ( num ; 5 )" means the telephone code 01234. 

 

But what I don't understand is "Middle ( num ; 6 ; 3 )". Does it mean start at number 6 and format 3 numbers i.e 567?

 

Could someone kindly explain the calculation to me?

 

Regards

 

Scott

Outcomes