09.11.2017, 04:11
strequal Fix
strequal - is a function, which compares string variables and values. Returns non-zero if the strings are equal. Fixed probability of a positive result in one blank line, and negative when it's two.
Example:
strequal - is a function, which compares string variables and values. Returns non-zero if the strings are equal. Fixed probability of a positive result in one blank line, and negative when it's two.
PHP код:
stock bool:strequal(const string1[], const string2[], bool:ignorecase = false, length = cellmax)
{
new
s1 = string1[0],
s2 = string2[0];
if ((s1 == '\0' || s2 == '\0') && (s1 != s2))
return false;
return strcmp(string1, string2, ignorecase, length) == 0;
}
PHP код:
main()
{
new
str_1[12] = "Hello World",
str_2[12] = "Hello World",
bool:inequality = strequal(str_1, str_2);
printf("%i", inequality); //inequality = 1
}