4D v14.3Position |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v14.3
Position
Position
Position returns the position of the first occurrence of find in aString. If aString 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 aString. If you ask for the position of an empty string within an empty string, Position returns zero (0). By default, the search begins at the first character of aString. The optional start parameter can be used to specify the character where the search will begin in aString. The lengthFound parameter, if passed, returns the length of the string actually found by the search. This parameter is necessary to be able to correctly manage letters that can be written using one or more characters (e.g.: æ and ae, ß and ss, etc.). By default, the command makes global comparisons that take linguistic particularities and letters that may be written with one or more characters (for example æ = ae) into account. On the other hand, it is not diacritical (a=A, a=à and so on) and does not take "ignorable" characters into account (Unicode specification). Ignorable characters include all characters in unicode C0 Control subset (U+0000 to U+001F, ascii character control set) except printable ones (U+0009 TAB, U+0010 LF, U+0011 VT, U+0012 FF and U+0013 CR).
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. 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 In the following example, the lengthFound parameter can be used to search for all the occurrences of "aegis" in a text, regardless of how it is written: $start:=1 |
PROPERTIES
Product: 4D
HISTORY
Modified: 4D v11 SQL SEE ALSO
Comparison Operators ARTICLE USAGE
4D Language Reference ( 4D v12.4) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||