Category: Text
Syntax: LeftWords ( text; numberOfWords ) |
Parameters:
textAny expression that resolves to a text field.
numberOfWordsAny positive number or expression that returns a positive number.
Data type returned: Text
Description:
Returns the first n number of words in a text expression, where n is the number specified in the numberOfWords parameter.
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 (-). For instance, LeftWords ("54.6"; 1) returns 54.6, but LeftWords ("x.y"; 1) returns x. 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 LeftWords() function. For example, LeftWords ("John Q. Public, Jr."; 2) returns John Q, but LeftWords ("John Q. Public, Jr."; 3) returns John Q. Public.
Examples:
Function | Results |
---|---|
LeftWords("the quick brown fox jumps"; 3) | Returns the quick brown. |
LeftWords(FullName; 1) | Returns Davie when FullName contains "Davie Jacques". |
: FileMaker Specifications
FileMaker 8 Product Line
Specifications and Storage Limits
Field Types and Import/Export Formats
: Calculation Functions
Working with Calculations Primer
Calculation Signatures
Calculation Functions
: Custom Functions
Custom Functions Primer
Useful Custom Functions
: Script Steps
Scripting Primer
Script Step Reference
: Quick Reference
FileMaker Error Codes
FileMaker Keyboard Shortcuts
FileMaker Network Ports
FileMaker Server Command Line Reference
FileMaker XML Reference
: Other Resources
Where to Go for More Information