Position()

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 8 Functions and Scripts Desk Reference
FileMaker 8 Functions and Scripts Desk Reference
ISBN: 0789735113
EAN: 2147483647
Year: 2004
Pages: 352
Simiral book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net