Find(Source: String; SubStr: String;[Start: Integer = 1]): Integer;
Source. Source string.
SubStr. Search substring.
Start. Number of the string position, from which to search for search substring.
The Find method returns number of the position of search substring beginning in the specified source string.
Features of method use:
If the specified substring is not found in the source string, the method returns 0.
Search for the search substring in the source string is case-sensitive.
Numbering of characters in a string starts with one.
Sub UserProc;
Var
s1, s2: String;
i: Integer;
Begin
s1 := "Calculator";
s2 := "cul";
// Find search substring position in source string
i := String.Find(s1, s2);
Debug.WriteLine("Find(""" + s1 + "; " + s2 + """) = " + i.ToString);
End Sub UserProc;
After executing the example position of the cul substring in the Calculator string is displayed in the console window.
See also: