added: CompareNoCase() to convert/text.h

git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1125 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2018-08-11 17:37:35 +00:00
parent 040eb12c8b
commit 239e1e4674
1 changed files with 24 additions and 0 deletions

View File

@ -131,6 +131,30 @@ bool EqualNoCase(const StringType1 & str1, const StringType2 & str2)
template<class StringType1, class StringType2>
int CompareNoCase(const StringType1 * str1, const StringType2 * str2)
{
while( *str1 && *str2 && ToLower(*str1) == ToLower(*str2) )
{
++str1;
++str2;
}
if( *str1 == 0 && *str2 == 0 )
return 0;
return (int)ToLower(*str1) - (int)ToLower(*str2);
}
template<class StringType1, class StringType2>
int CompareNoCase(const StringType1 & str1, const StringType2 & str2)
{
return CompareNoCase(str1.c_str(), str2.c_str());
}
template<class StringType1, class StringType2>
bool EqualNoCase(const StringType1 * str1_begin, const StringType1 * str1_end, const StringType2 * str2)
{