version 3
Position (find; string) Number
Parameter | Type | Description | |
find | String | String to find | |
string | String | String in which to search | |
Function result | Number | Position of first occurrence |
Description
Position returns the position of the first occurrence of find in string.
If string does not contain find, it returns a zero (0).
If Position locates an occurrence of find, it returns the position of the first character of the occurrence in string.
If you ask for the position of an empty string within an empty string, Position returns zero (0).
Warning: You cannot use the @ wildcard character with Position. For example, if you pass "abc@" in find, the command will actually look for "abc@" and not for "abc" plus any character.
Examples
1. This example illustrates the use of Position. The results, described in the comments, are assigned to the variable vlResult.
vlResult := Position ("ll"; "Willow") ` vlResult gets 3 vlResult := Position (vtText1; vtText2) ` Returns first occurrence of vtText1 in vtText2
2. See example for the command Substring.
See Also
Comparison Operators, Substring.