2 Replies Latest reply on Mar 15, 2011 2:57 PM by scottlynch

# Format text field for UK telephone numbers

### 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

• ###### 1. Re: Format text field for UK telephone numbers

Sounds like you've correctly explained it to yourself already. All such functions are documented in FileMaker help so that's good place to start when deciphering an expression that isn't immediately obvious to you.

Middle does indeed work like you've guessed: Middle ( text ; starting character ; number of characters )

• ###### 2. Re: Format text field for UK telephone numbers

Many thanks for the reply Phil, I just needed some clarification that my line of thinking was on the right track