diff src/core/strings.cpp @ 15:cde8f67a7c7d

*: update, megacommit :)
author Paper <mrpapersonic@gmail.com>
date Tue, 19 Sep 2023 22:36:08 -0400
parents 5c0397762b53
children 4c6dd5999b39
line wrap: on
line diff
--- a/src/core/strings.cpp	Tue Sep 19 16:33:07 2023 -0400
+++ b/src/core/strings.cpp	Tue Sep 19 22:36:08 2023 -0400
@@ -2,7 +2,8 @@
  * strings.cpp: Useful functions for manipulating strings
  **/
 #include "core/strings.h"
-#include <codecvt>
+#include <algorithm>
+#include <cctype>
 #include <locale>
 #include <string>
 #include <vector>
@@ -59,4 +60,19 @@
 	return RemoveHtmlTags(SanitizeLineEndings(string));
 }
 
+/* these functions suck for i18n!...
+   but we only use them with JSON
+   stuff anyway */
+std::string ToUpper(const std::string& string) {
+	std::string result(string);
+	std::transform(result.begin(), result.end(), result.begin(), [](unsigned char c) { return std::toupper(c); });
+	return result;
+}
+
+std::string ToLower(const std::string& string) {
+	std::string result(string);
+	std::transform(result.begin(), result.end(), result.begin(), [](unsigned char c) { return std::tolower(c); });
+	return result;
+}
+
 } // namespace Strings