aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/utility/StringUtils.hpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-09-20 14:11:27 +0200
committer GitHub <noreply@github.com>2024-09-20 14:11:27 +0200
commit89b1333b1edff6c08750bd836ae92eccbe06e3bd (patch)
treeed4e867e2c099b027da2e2205b99575edae7b561 /src/openvic-simulation/utility/StringUtils.hpp
parentf0814926f675d6ecf889d8add410b1c37f625b29 (diff)
parent5550b237fa9b6f8c6a86eea0de9d32e28a626dc7 (diff)
Merge pull request #201 from OpenVicProject/rule-modifier-locale-keys
ModifierEffect and Rule localisation keys
Diffstat (limited to 'src/openvic-simulation/utility/StringUtils.hpp')
-rw-r--r--src/openvic-simulation/utility/StringUtils.hpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/openvic-simulation/utility/StringUtils.hpp b/src/openvic-simulation/utility/StringUtils.hpp
index bec11ec..53feb9d 100644
--- a/src/openvic-simulation/utility/StringUtils.hpp
+++ b/src/openvic-simulation/utility/StringUtils.hpp
@@ -160,6 +160,22 @@ namespace OpenVic::StringUtils {
return std::equal(lhs.begin(), lhs.end(), rhs.begin(), rhs.end(), ichar_equals);
}
+ inline constexpr std::string string_tolower(std::string_view str) {
+ std::string result { str };
+ std::transform(result.begin(), result.end(), result.begin(),
+ [](unsigned char c) -> unsigned char { return std::tolower(c); }
+ );
+ return result;
+ }
+
+ inline constexpr std::string string_toupper(std::string_view str) {
+ std::string result { str };
+ std::transform(result.begin(), result.end(), result.begin(),
+ [](unsigned char c) -> unsigned char { return std::toupper(c); }
+ );
+ return result;
+ }
+
inline constexpr std::string_view get_filename(std::string_view path) {
size_t pos = path.size();
while (pos > 0 && path[pos - 1] != '/' && path[pos - 1] != '\\') {