summaryrefslogtreecommitdiff
path: root/zen/string_tools.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <shieldwed@outlook.com>2018-05-09 00:09:55 +0200
committerDaniel Wilhelm <shieldwed@outlook.com>2018-05-09 00:09:55 +0200
commit9b623ea3943165fe7efb5e47a0b5b9452c1599e6 (patch)
treedde40e07e907ac6e0ca9ea32524f2cd4810d4be6 /zen/string_tools.h
parent9.7 (diff)
downloadFreeFileSync-9b623ea3943165fe7efb5e47a0b5b9452c1599e6.tar.gz
FreeFileSync-9b623ea3943165fe7efb5e47a0b5b9452c1599e6.tar.bz2
FreeFileSync-9b623ea3943165fe7efb5e47a0b5b9452c1599e6.zip
9.8
Diffstat (limited to 'zen/string_tools.h')
-rwxr-xr-xzen/string_tools.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/zen/string_tools.h b/zen/string_tools.h
index 5058f78d..7734b6f0 100755
--- a/zen/string_tools.h
+++ b/zen/string_tools.h
@@ -27,6 +27,7 @@ template <class Char> bool isDigit (Char c); //not exactly the same as "std:
template <class Char> bool isHexDigit (Char c);
template <class Char> bool isAsciiAlpha(Char c);
template <class Char> Char asciiToLower(Char c);
+template <class Char> Char asciiToUpper(Char c);
//case-sensitive comparison (compile-time correctness: use different number of arguments as STL comparison predicates!)
struct CmpBinary { template <class Char> int operator()(const Char* lhs, size_t lhsLen, const Char* rhs, size_t rhsLen) const; };
@@ -159,6 +160,15 @@ Char asciiToLower(Char c)
}
+template <class Char> inline
+Char asciiToUpper(Char c)
+{
+ if (static_cast<Char>('a') <= c && c <= static_cast<Char>('z'))
+ return static_cast<Char>(c - static_cast<Char>('a') + static_cast<Char>('A'));
+ return c;
+}
+
+
template <class S, class T, class Function> inline
bool startsWith(const S& str, const T& prefix, Function cmpStringFun)
{
@@ -740,7 +750,7 @@ std::pair<char, char> hexify(unsigned char c, bool upperCase)
else
return static_cast<char>('a' + (num - 10));
};
- return std::make_pair(hexifyDigit(c / 16), hexifyDigit(c % 16));
+ return { hexifyDigit(c / 16), hexifyDigit(c % 16) };
}
bgstack15