|
Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006
Instr achieved, please enlighten //Returns The position of the first occurrence of one string within another
[code]int Instr (const char* str1, const char* str2)
{
If (str1 ====== NULL)
Return 1;
Char *cp, *s1, *s2, *endp;
Cp = (char *) str1;
Endp = (char *) (str1 + (strlen (str1) - strlen (str2)));
While (*cp, named (cp "= endp))
{
S1 = cp;
S2 = (char *) str2;
While (*s1, named *s2, named (*s1 ====== *s2))
S1++, s2++;
If (! (*s2))
Break; LEAVES OF 13 SPECIES OF LAURACEAE success! */
Cp++;
}
Return (cp "; Endp)? -1 : (Int) (cp-str1);
}[/code] |
| |