mirror of https://github.com/kiwix/libkiwix.git
Rename split argument from `trimEmpty` to `dropEmpty`.
This commit is contained in:
parent
18b6433322
commit
0b6b6716de
|
@ -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<std::string> split(const std::string& str, const std::string& delims, bool trimEmpty=true, bool keepDelim = false);
|
||||
std::vector<std::string> split(const std::string& str, const std::string& delims, bool dropEmpty=true, bool keepDelim = false);
|
||||
|
||||
/** Convert language code from iso2 code to iso3
|
||||
*
|
||||
|
|
|
@ -270,7 +270,7 @@ std::string kiwix::urlDecode(const std::string& value, bool component)
|
|||
/* Split string in a token array */
|
||||
std::vector<std::string> 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<std::string> 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<std::string> 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;
|
||||
|
|
Loading…
Reference in New Issue