Middle()

Category: Text

Syntax: Middle ( text; startCharacter; numberOfCharacters )

Parameters:

textAny expression that resolves to a text string.

startCharacterAny expression that resolves to a numeric value.

numberOfCharactersAny expression that resolves to a numeric value.

Data type returned: Text

Description:

Returns a substring from the middle of the specified text parameter. The substring begins at startCharacter and extracts the numberOfCharacters characters following it. If the end of the string is encountered before the specified number of characters has been extracted, the function returns everything from the start position though the end of the string.

The Middle() function is often used in conjunction with other text functions as part of text parsing routines. For instance, if you had a field containing city, state, and ZIP data where the entries were consistently entered as "city, state zip", you could extract the state portion of the string with the following formula:

Let ([commaPosition = Position(CSZ; ","; 1; 1); Middle (CSZ; commaPosition + 2; 2))

Examples:

Function

Results

Middle ("hello world"; 3; 5)

Returns llo w.

Middle (FirstName; 2; 99999)

Returns everything except the first character of the first name.

Категории