Category: Text
Syntax: Position ( text ; searchString ; start ; occurrence ) |
Parameters:
textAny expression that resolves to a text string in which you want to search.
searchStringAny expression that resolves to a text string for which to search.
startAn integer representing the character number at which to begin searching.
occurrenceAn integer representing which occurrence of searchString to locate. A negative number causes the search to proceed backward from the start character.
Data type returned: Number
Description:
Returns the character number where the searchString is found within the specified text string. If the searchString is not found, the Position() function returns a 0.
In most cases, the Position() function is used to find the first occurrence of some substring within a string. Both the start and occurrence parameters will simply be 1 in such instances.
To find the last occurrence of a substring within a string, set the start parameter to be the length of the string and the occurrence parameter to be -1, indicating that the function should search backward from the end of the string for the first occurrence of the substring.
The Position() function is not case sensitive.
Examples:
Function | Results |
---|---|
Position ("This is a est"; "is"; 1; 1) | Returns 3. |
Position ("This is a test"; "is"; 1; 2) | Returns 6. |
Position ("Let (myString = "This is a test"; Position (myString; " "; Length (myString); -1)) | Returns 10, which is the position of the last space in myString. |
: 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