some small refactoring

This commit is contained in:
2021-12-19 13:34:29 +01:00
parent 5c925f2608
commit 8ea91f255b
5 changed files with 49 additions and 52 deletions

View File

@@ -81,7 +81,7 @@ std::vector<std::vector<std::string>> regexp_tokens(const std::string &str, cons
captured_subgroups.push_back(res[i]);
}
}
if (captured_subgroups.size() > 0)
if (!captured_subgroups.empty())
captured_groups.push_back(captured_subgroups);
searchStart += res.position() + res.length();
@@ -119,7 +119,7 @@ std::string string_trim(std::string s, const std::string &chars_to_trim, const s
}
std::string string_padd(const std::string &str, int pad_len, char fill_char, bool from_right) {
int str_len = str.length();
auto str_len = str.length();
if (str_len == pad_len)
return str;
@@ -154,6 +154,6 @@ size_t string_find_substr(const std::string & str, const std::string & pattern,
}
size_t p = str.find(pattern, pos);
return p != str.npos ? p : -1;
}