Can somebody give me more details about containi? I cannot understand it properly.
The code isn't helping me to much(craziness)
PHP Code:
static cell AMX_NATIVE_CALL contain(AMX *amx, cell *params) /* 2 param */
{
register cell *a = get_amxaddr(amx, params[2]);
register cell *b = get_amxaddr(amx, params[1]);
register cell *c = b;
cell* str = b;
cell* substr = a;
while (*c)
{
if (*c == *a)
{
c++;
if (!*++a)
return b - str;
} else {
c = ++b;
a = substr;
}
}
return -1;
}
static cell AMX_NATIVE_CALL containi(AMX *amx, cell *params) /* 2 param */
{
register cell *a = get_amxaddr(amx, params[2]);
register cell *b = get_amxaddr(amx, params[1]);
register cell *c = b;
cell* str = b;
cell* substr = a;
while (*c)
{
if (tolower(*c) == tolower(*a))
{
c++;
if (!*++a)
return b - str;
} else {
c = ++b;
a = substr;
}
}
return -1;
}
__________________