From b48d68f0b71d32e22363bf0e58b4bbea1cb09d61 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sat, 20 Oct 2012 20:33:36 +0200 Subject: [PATCH] utility/string: remove unused functions --- src/utility/string.cpp | 66 ------------------------------------------ 1 file changed, 66 deletions(-) diff --git a/src/utility/string.cpp b/src/utility/string.cpp index 134a2a3e..22e103cb 100644 --- a/src/utility/string.cpp +++ b/src/utility/string.cpp @@ -23,16 +23,6 @@ #include #include "utility/string.h" -int stringToInt(const std::string &s) -{ - return atoi(s.c_str()); -} - -long stringToLongInt(const std::string &s) -{ - return atol(s.c_str()); -} - bool isInteger(const char *s, bool accept_signed) { assert(s); @@ -44,62 +34,6 @@ bool isInteger(const char *s, bool accept_signed) return true; } -std::vector split(const std::string &s, const std::string &delimiter) -{ - if (delimiter.empty()) - return { s }; - std::vector result; - size_t i = 0, j = 0; - while (true) - { - i = j; - j = s.find(delimiter, i); - if (j == std::string::npos) - break; - else - result.push_back(s.substr(i, j-i)); - j += delimiter.length(); - } - result.push_back(s.substr(i)); - return result; -} - -void replace(std::string &s, const std::string &from, const std::string &to) -{ - for (size_t i = 0; (i = s.find(from, i)) != std::string::npos; i += to.length()) - s.replace(i, from.length(), to); -} - -void lowercase(std::string &s) -{ - std::transform(s.begin(), s.end(), s.begin(), tolower); -} - -void lowercase(std::wstring &ws) -{ - std::transform(ws.begin(), ws.end(), ws.begin(), towlower); -} - -void trim(std::string &s) -{ - if (s.empty()) - return; - - size_t b = 0; - size_t e = s.length()-1; - - while (s[e] == ' ' || s[e] == '\n' || s[e] == '\t') - --e; - ++e; - if (e != s.length()) - s.resize(e); - - while (s[b] == ' ' || s[b] == '\n' || s[e] == '\t') - ++b; - if (b != 0) - s = s.substr(b); -} - std::string getBasename(const std::string &path) { size_t slash = path.rfind("/");