Language Reference Guide : System Classes : StringObject Class : LocateString Method
 
Share this page          
LocateString Method
The LocateString method finds the first occurrence of a text string.
This method has the following syntax:
integer = StringObject.LocateString(match = varchar(256)
          [, startposition = integer]
          [, ignorecase = integer]
          [, backwards = integer])
This method has the following parameters:
match
(Required) Specifies the string to match
startposition
Specifies the ordinal position of the character at which you want to begin the search.
Default:
If the backwards parameter is omitted or FALSE: 1
If the backwards parameter is TRUE: equal to the length of the StringObject
ignorecase
Specifies whether the search is case-sensitive. If ignorecase is omitted or is FALSE, the search is case sensitive. If ignorecase is TRUE, the search is case insensitive.
backwards
Specifies in which direction the search occurs. If backwards is omitted or is FALSE, the search proceeds forward from startposition. If backwards is TRUE, the search proceeds backward from startposition. Startposition marks the leftmost character of the text being searched for, not the rightmost character.
This method finds the first occurrence of the string specified in the match parameter and returns the ordinal position of its first character. It begins the search at the position specified in the startposition parameter. (In string objects, character positions are numbered from left to right, starting with number one.) You cannot use pattern-matching characters in the match parameter.
If no match is found, the method returns zero.