diff options
author | Yehonal <yehonal.azeroth@gmail.com> | 2022-10-22 00:21:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-22 00:21:16 +0200 |
commit | 77a52b8001ba6292b87138471deb7d8aa7b84e4b (patch) | |
tree | fd5415c79c93af30c978603b9c525d34a261a7fc /src/common/Utilities/StringFormat.cpp | |
parent | 53219310cfbb356afacb7419ee1c1a24b12bf750 (diff) |
fix(CORE): another attempt to fix the dbimport command line warning (#13449)
Diffstat (limited to 'src/common/Utilities/StringFormat.cpp')
-rw-r--r-- | src/common/Utilities/StringFormat.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/common/Utilities/StringFormat.cpp b/src/common/Utilities/StringFormat.cpp index 83e2d2a468..c547a2d710 100644 --- a/src/common/Utilities/StringFormat.cpp +++ b/src/common/Utilities/StringFormat.cpp @@ -64,5 +64,19 @@ std::string Acore::String::TrimRightInPlace(std::string& str) return str; } +/** + * @brief Util function to add a suffix char. Can be used to add a slash at the end of a path + * + * @param str String where to apply the suffix + * @param suffix Character to add at the end of the str + * @return std::string Suffixed string + */ +std::string Acore::String::AddSuffixIfNotExists(std::string str, const char suffix) { + if (str.empty() || (str.at(str.length() - 1) != suffix)) + str.push_back(suffix); + + return str; +} + // Template Trim template AC_COMMON_API std::string Acore::String::Trim<std::string>(const std::string& s, const std::locale& loc /*= std::locale()*/); |