diff --git a/include/tools.h b/include/tools.h index 6ee389646..150348929 100644 --- a/include/tools.h +++ b/include/tools.h @@ -155,7 +155,7 @@ void sleep(unsigned int milliseconds); * @param keepDelim true if delimiter must be included from the result. * @return a list of part (potentially containing delimiters) */ -std::vector split(const std::string& str, const std::string& delims, bool trimEmpty=true, bool keepDelim = false); +std::vector split(const std::string& str, const std::string& delims, bool dropEmpty=true, bool keepDelim = false); /** Convert language code from iso2 code to iso3 * diff --git a/src/tools/stringTools.cpp b/src/tools/stringTools.cpp index 7c39bb037..6d6e1d39e 100644 --- a/src/tools/stringTools.cpp +++ b/src/tools/stringTools.cpp @@ -270,7 +270,7 @@ std::string kiwix::urlDecode(const std::string& value, bool component) /* Split string in a token array */ std::vector kiwix::split(const std::string& str, const std::string& delims, - bool trimEmpty, + bool dropEmpty, bool keepDelim) { std::string::size_type lastPos = 0; @@ -279,7 +279,7 @@ std::vector kiwix::split(const std::string& str, while( (pos = str.find_first_of(delims, lastPos)) < str.length() ) { auto token = str.substr(lastPos, pos - lastPos); - if (!trimEmpty || !token.empty()) { + if (!dropEmpty || !token.empty()) { tokens.push_back(token); } if (keepDelim) { @@ -289,7 +289,7 @@ std::vector kiwix::split(const std::string& str, } auto token = str.substr(lastPos); - if (!trimEmpty || !token.empty()) { + if (!dropEmpty || !token.empty()) { tokens.push_back(token); } return tokens;