diff --git a/src/clutils/Str.cc b/src/clutils/Str.cc index 2a0a1607..29496d9c 100644 --- a/src/clutils/Str.cc +++ b/src/clutils/Str.cc @@ -96,6 +96,15 @@ const char * StrToConstant( const char * word, std::string & s ) { return const_cast( s.c_str() ); } +int StrCmpIns( const char * str1, const char * str2 ) { + char c1, c2; + while ((c1 = tolower(*str1)) == (c2 = tolower(*str2)) && c1 != '\0') { + str1++; + str2++; + } + return c1 - c2; +} + /**************************************************************//** ** \fn PrettyTmpName (char * oldname) ** \returns a new capitalized name in a static buffer diff --git a/src/clutils/Str.h b/src/clutils/Str.h index 25643751..efdd1bcf 100644 --- a/src/clutils/Str.h +++ b/src/clutils/Str.h @@ -21,23 +21,13 @@ #include #include - -//StrCmpIns - case-insensitive string compare. Original fct (replaced Sep 2011) -//called PrettyTmpName(). Not doing so may affect sort order but that shouldn't hurt -#if defined(__MSVC__) -#define StrCmpIns(a,b) _stricmp(a,b) -#elif defined(__BORLAND__) -#define StrCmpIns(a,b) stricmp(a,b) -#else -#define StrCmpIns(a,b) strcasecmp(a,b) -#endif - SCL_UTILS_EXPORT char ToLower( const char c ); SCL_UTILS_EXPORT char ToUpper( const char c ); SCL_UTILS_EXPORT char * StrToLower( const char *, char * ); SCL_UTILS_EXPORT const char * StrToLower( const char * word, std::string & s ); SCL_UTILS_EXPORT const char * StrToUpper( const char * word, std::string & s ); SCL_UTILS_EXPORT const char * StrToConstant( const char * word, std::string & s ); +SCL_UTILS_EXPORT int StrCmpIns( const char *str1, const char *str2 ); SCL_UTILS_EXPORT const char * PrettyTmpName( const char * oldname ); SCL_UTILS_EXPORT char * PrettyNewName( const char * oldname ); SCL_UTILS_EXPORT char * EntityClassName( char * oldname );