J
JKop
Comments, Questions and Suggestions please!
Returns true if strings are identical, returns false if strings are not
identical. (without regard to case).
bool CompareWithoutRegardToCase(const char* x, const char* y)
{
//Undefined Behaviour if supplied with null pointers ;-D
if ( !*x || !*y ) //valid pointer to null string
{
if ( !*x && !*y ) return true; //2 null strings are equal.
return false;
}
do
{
if ( tolower( static_cast<unsigned char>(*x) ) == tolower(
static_cast<unsigned char>(*y) ) ) continue;
else
{
return false;
}
}
while ( (++x,++y) ,*x );
return !*y;
}
Returns true if strings are identical, returns false if strings are not
identical. (without regard to case).
bool CompareWithoutRegardToCase(const char* x, const char* y)
{
//Undefined Behaviour if supplied with null pointers ;-D
if ( !*x || !*y ) //valid pointer to null string
{
if ( !*x && !*y ) return true; //2 null strings are equal.
return false;
}
do
{
if ( tolower( static_cast<unsigned char>(*x) ) == tolower(
static_cast<unsigned char>(*y) ) ) continue;
else
{
return false;
}
}
while ( (++x,++y) ,*x );
return !*y;
}