Position

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 3


Position (find; string) Number

ParameterTypeDescription
findStringString to find
stringStringString in which to search
Function resultNumberPosition 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.


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next