Available in:
Apps (win)
Apps (char)
Reportwriter
RPC
Standalone PL
X
X
X
X
X
int instr(char1,char2[,n[,m]]) string char1,char2 int n,m
| char1 | specifies the string in which to search.
|
| char2 | specifies the string to search for.
The position of char2 is relative to the first character of
char1, even when n > 1.
|
| n | (optional) specifies the place at which to begin searching.
If the value of the parameter is negative, the search begins from the back of the string.
|
| m | (optional) specifies the occurrence. |
{
char s[80], t[80], u[80];
s = "This is an example for Trifox's TRIMpl";
t = "Trifox";
u = "No";
printf("The location of Trifox within the string is " ^^ instr(s,t));
printf("The location of No within the string is " ^^ instr(s, u));
}
The following returns the position of the last slash (/), in this case, 22.
Note that the position is always returned from the beginning of the string and
that it is 1-based.
instr("/usr2/rad/cheetah/lib/trim.ini", "/", -1)