Middle

Extracts the specified numberOfCharacters from text, starting at the specified character position.

Format 

Middle ( text ; start ; numberOfCharacters )

Parameters 

text - any text expression or text field

start - any numeric expression or field containing a number

numberOfCharacters - any numeric expression or field containing a number

Data type returned 

text

Originated in version 

6.0 or earlier

Description 

If start ≤ 1, then this function is evaluated as if start = 1. If start is greater than the length of text, this function returns nothing.

Example 1 

Middle ( "(408)555-9054" ; 2 ; 3 ) returns 408.

Example 2 

Middle ( PhoneNumber ; 2 ; 3 ) returns 408 when the PhoneNumber field contains (408) 555-9054.

Example 3 

Middle ("abcdefghij" ; 5 ; 2 ) returns ef.

Example 4 

Middle ( Name ; Position ( Name ; " " ; 1 ; 1 ) + 1 ; 3 ) returns Smi, when the text field Name contains John Smith.