summaryrefslogtreecommitdiffstats
path: root/source/StringUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/StringUtils.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/source/StringUtils.cpp b/source/StringUtils.cpp
index ccdbe687a..e3eb95a6e 100644
--- a/source/StringUtils.cpp
+++ b/source/StringUtils.cpp
@@ -172,6 +172,33 @@ int NoCaseCompare(const AString & s1, const AString & s2)
+unsigned int RateCompareString(const AString & s1, const AString & s2 )
+{
+ unsigned int MatchedLetters = 0;
+ unsigned int s1Length = s1.length();
+
+ if( s1Length > s2.length() ) return 0; // Definitely not a match
+
+ for (unsigned int i = 0; i < s1Length; i++)
+ {
+ char c1 = (char)toupper( s1[i] );
+ char c2 = (char)toupper( s2[i] );
+ if( c1 == c2 )
+ {
+ ++MatchedLetters;
+ }
+ else
+ {
+ break;
+ }
+ }
+ return MatchedLetters;
+}
+
+
+
+
+
void ReplaceString(AString & iHayStack, const AString & iNeedle, const AString & iReplaceWith)
{
size_t pos1 = iHayStack.find(iNeedle);