diff options
author | hop311 <hop3114@gmail.com> | 2024-09-19 00:07:28 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-09-19 00:07:28 +0200 |
commit | 5550b237fa9b6f8c6a86eea0de9d32e28a626dc7 (patch) | |
tree | ed4e867e2c099b027da2e2205b99575edae7b561 /src/openvic-simulation/utility/StringUtils.hpp | |
parent | f0814926f675d6ecf889d8add410b1c37f625b29 (diff) |
ModifierEffect and Rule localisation keysrule-modifier-locale-keys
Diffstat (limited to 'src/openvic-simulation/utility/StringUtils.hpp')
-rw-r--r-- | src/openvic-simulation/utility/StringUtils.hpp | 16 |
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] != '\\') { |