Pos
This document is no longer available beyond version 21.0. Information can now be found here: Pos for version 25
Parent page: System Query Functions - System Functions
Summary
Returns the index value of the first character in a specified substring that occurs in a given string.
Syntax
Pos(Substr : String , S : String) : Integer
Pos searches for a substring, Substr, within a string, S. Substr and S are string-type expressions. An integer value is returned that is the index of the first character of Substr.
Example Usage
Pos('T',Name) = 1
Returns all objects that have a Name property whose associated string first contains 'T' at its first position; 'T1' and 'Time Table' are examples of such strings. ('T' is located twice within the string 'Time Table', but the first location of this is at its first position.)
Pos('A',Name) = 2
Returns all objects that have a Name property whose associated string first contains 'A' at its second position; 'RA1' and 'CABLE CHART' are examples of such strings.
Pos('B',Name) = 0
Returns all objects that have a Name property whose associated string does not contain 'B' at any position; 'D1' and 'Time Table' are examples of such strings. (The string of 'Time Table' contains 'b' at its eighth position, but Pos is case-sensitive.)
Pos('D',Name) > 0
Returns all objects that have a Name property whose associated string contains 'D' at at least one position and at any location(s); 'Data Chart', 'U1D', and 'Install either D1 and D2 or D3 and D4, but never install all of these.' are examples of such strings.
Pos('Con',Name) = 1
Returns all objects that have a Name property whose associated string first contains 'Con' at its first, second, and third positions; 'Concatenate' is an example of a such string. (The first location of 'Con' within 'Concatenate' is the first three characters of this; the first character within 'Con' is 'C', and its location is the first character of 'Concatenate'.)
Pos('ate',Name) = 5
Returns all objects that have a Name property whose associated string first contains 'ate' at its fifth, sixth, and seventh positions; 'Concatenate' is an example of a such string. (The first location of 'ate' within 'Concatenate' is the fifth through to seventh characters of this; the first character within 'ate' is 'a', and its location is the fifth character of 'Concatenate'.)
Pos('ate',Name) = 0
Returns all objects that have a Name property whose associated string does not contain 'ate' anywhere; 'C1' and 'TIME:' are examples of such strings.