From 239e1e46748b458260077d4a291b79e4122916f5 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Sat, 11 Aug 2018 17:37:35 +0000 Subject: [PATCH] added: CompareNoCase() to convert/text.h git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1125 e52654a7-88a9-db11-a3e9-0013d4bc506e --- convert/text.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/convert/text.h b/convert/text.h index ba6c6ca..8fbb98f 100644 --- a/convert/text.h +++ b/convert/text.h @@ -131,6 +131,30 @@ bool EqualNoCase(const StringType1 & str1, const StringType2 & str2) +template +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 +int CompareNoCase(const StringType1 & str1, const StringType2 & str2) +{ + return CompareNoCase(str1.c_str(), str2.c_str()); +} + + + template bool EqualNoCase(const StringType1 * str1_begin, const StringType1 * str1_end, const StringType2 * str2) {