leocad/qt/system.cpp

45 lines
611 B
C++
Raw Normal View History

2013-08-09 06:57:18 +02:00
#include "lc_global.h"
#ifdef WIN32
char* strcasestr(const char *s, const char *find)
{
char c, sc;
if ((c = *find++) != 0)
{
c = tolower((unsigned char)c);
2019-05-18 20:33:27 +02:00
int len = (int)strlen(find);
2013-08-09 06:57:18 +02:00
do
{
do
{
if ((sc = *s++) == 0)
return (nullptr);
2013-08-09 06:57:18 +02:00
} while ((char)tolower((unsigned char)sc) != c);
2017-02-07 18:35:11 +01:00
} while (qstrnicmp(s, find, len) != 0);
2013-08-09 06:57:18 +02:00
s--;
}
return ((char *)s);
}
#else
char* strupr(char *string)
{
for (char *c = string; *c; c++)
*c = toupper(*c);
return string;
}
char* strlwr(char *string)
{
for (char *c = string; *c; c++)
*c = tolower(*c);
return string;
}
#endif