From d6b35e97be2c7b6809ff94ca076f4a02e4238898 Mon Sep 17 00:00:00 2001 From: 0xFFFC0000 <0xFFFC0000@proton.me> Date: Fri, 15 Mar 2024 11:24:12 +0000 Subject: Cleanup string_tools. 1. Use boost::filesystem for already available operations. 2. Use boost::string for already available operations. --- contrib/epee/include/string_tools.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'contrib/epee/include') diff --git a/contrib/epee/include/string_tools.h b/contrib/epee/include/string_tools.h index dbbe1906e..31c55b97b 100644 --- a/contrib/epee/include/string_tools.h +++ b/contrib/epee/include/string_tools.h @@ -31,6 +31,7 @@ #include "mlocker.h" #include +#include #include #include #include @@ -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); -- cgit v1.2.3