MiddleWords()

Category: Text

Syntax: MiddleWords ( text; startingWord; numberOfWords )

Parameters:

textAny expression that resolves to a text string.

startingWordAny positive number or expression that returns a positive number.

numberOfWordsAny positive number or expression that returns a positive number.

Data type returned: Text

Description:

The MiddleWords() function extracts a substring from the middle of a text string. The substring begins with the nth word of the text string (where n represents the startingWord parameter) and extends for the number of words specified by the third parameter.

MiddleWords( text; 1; 1) and LeftWords( text; 1) are equivalent functions.

Be aware of what symbols are considered to be word breaks by FileMaker Pro. Spaces, return characters, and most punctuation symbols are considered to be word breaks. Multiple word breaks next to each other (for example, two spaces, a comma, and a space) are considered as a single word break.

Certain punctuation symbols are word breaks when separating alpha characters but not when separating numeric characters. These include the colon (:), slash (/), period (.), comma (,), and dash (-). The reason for this behavior is that those symbols are valid date, time, and number separators.

Leading and trailing punctuation around a word may be ignored by the MiddleWords() function. For example, MiddleWords ("John Q. Public, Jr."; 2; 1) returns Q, but MiddleWords ("John Q. Public, Jr."; 2; 1) returns Q. Public.

Examples:

Function

Results

MiddleWords ("the quick brown fox jumps"; 3; 2)

Returns brown fox.

MiddleWords (FullName"; 2; 1)

Returns Allan when FullName contains "Edgar Allan Poe."

Категории