Mercurial > minori
comparison 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 |
comparison
equal
deleted
inserted
replaced
14:a29c9402faf0 | 15:cde8f67a7c7d |
---|---|
1 /** | 1 /** |
2 * strings.cpp: Useful functions for manipulating strings | 2 * strings.cpp: Useful functions for manipulating strings |
3 **/ | 3 **/ |
4 #include "core/strings.h" | 4 #include "core/strings.h" |
5 #include <codecvt> | 5 #include <algorithm> |
6 #include <cctype> | |
6 #include <locale> | 7 #include <locale> |
7 #include <string> | 8 #include <string> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 namespace Strings { | 11 namespace Strings { |
57 | 58 |
58 std::string TextifySynopsis(const std::string& string) { | 59 std::string TextifySynopsis(const std::string& string) { |
59 return RemoveHtmlTags(SanitizeLineEndings(string)); | 60 return RemoveHtmlTags(SanitizeLineEndings(string)); |
60 } | 61 } |
61 | 62 |
63 /* these functions suck for i18n!... | |
64 but we only use them with JSON | |
65 stuff anyway */ | |
66 std::string ToUpper(const std::string& string) { | |
67 std::string result(string); | |
68 std::transform(result.begin(), result.end(), result.begin(), [](unsigned char c) { return std::toupper(c); }); | |
69 return result; | |
70 } | |
71 | |
72 std::string ToLower(const std::string& string) { | |
73 std::string result(string); | |
74 std::transform(result.begin(), result.end(), result.begin(), [](unsigned char c) { return std::tolower(c); }); | |
75 return result; | |
76 } | |
77 | |
62 } // namespace Strings | 78 } // namespace Strings |