diff options
author | 0xFFFC0000 <0xFFFC0000@proton.me> | 2024-03-15 11:24:12 +0000 |
---|---|---|
committer | 0xFFFC0000 <0xFFFC0000@proton.me> | 2024-03-15 14:54:23 +0330 |
commit | c56ee140df25577066064b36508accd7a43d976c (patch) | |
tree | bb1e083ad06ac0a97fcbbea2f2708e9e8e6302eb /contrib/epee/include/string_tools.h | |
parent | Merge pull request #9243 (diff) | |
download | monero-c56ee140df25577066064b36508accd7a43d976c.tar.xz |
Cleanup string_tools.
1. Use boost::filesystem for already available operations.
2. Use boost::string for already available operations.
Diffstat (limited to '')
-rw-r--r-- | contrib/epee/include/string_tools.h | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/contrib/epee/include/string_tools.h b/contrib/epee/include/string_tools.h index 7fcd02726..887f4aa40 100644 --- a/contrib/epee/include/string_tools.h +++ b/contrib/epee/include/string_tools.h @@ -31,6 +31,7 @@ #include "mlocker.h" #include <boost/utility/string_ref.hpp> +#include <boost/algorithm/string.hpp> #include <sstream> #include <string> #include <cstdint> @@ -69,23 +70,19 @@ namespace string_tools #ifdef _WIN32 std::string get_current_module_path(); #endif - bool set_module_name_and_folder(const std::string& path_to_process_); - bool trim_left(std::string& str); - bool trim_right(std::string& str); + void set_module_name_and_folder(const std::string& path_to_process_); + void trim_left(std::string& str); + void trim_right(std::string& str); //---------------------------------------------------------------------------- inline std::string& trim(std::string& str) { - trim_left(str); - trim_right(str); + boost::trim(str); return str; } //---------------------------------------------------------------------------- - inline std::string trim(const std::string& str_) + inline std::string trim(const std::string& str) { - std::string str = str_; - trim_left(str); - trim_right(str); - return str; + return boost::trim_copy(str); } std::string pad_string(std::string s, size_t n, char c = ' ', bool prepend = false); |