diff options
| author | ilotterytea <iltsu@alright.party> | 2024-05-18 14:48:12 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-05-18 14:48:12 +0500 |
| commit | d1793df1eda463b10107d41785ad1d7f055ed476 (patch) | |
| tree | fd3e41c3b4a05924748ae4b762e1ae55a0bc815c /src/utils/string.cpp | |
| parent | d7a2de17e9b7931f68b5b4079b1c36866a19d343 (diff) | |
upd: moved the bot part to a relative subfolder
Diffstat (limited to 'src/utils/string.cpp')
| -rw-r--r-- | src/utils/string.cpp | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/src/utils/string.cpp b/src/utils/string.cpp deleted file mode 100644 index 71c06bf..0000000 --- a/src/utils/string.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "string.hpp" - -#include <sstream> -#include <string> -#include <vector> - -namespace bot { - namespace utils { - namespace string { - std::vector<std::string> split_text(const std::string &text, - char delimiter) { - std::vector<std::string> parts; - - std::istringstream iss(text); - std::string part; - - while (std::getline(iss, part, delimiter)) { - parts.push_back(part); - } - - return parts; - } - - std::string join_vector(const std::vector<std::string> &vec, - char delimiter) { - if (vec.empty()) { - return ""; - } - - std::string str; - - for (auto i = vec.begin(); i != vec.end() - 1; i++) { - str += *i + delimiter; - } - - str += vec[vec.size() - 1]; - - return str; - } - - std::string join_vector(const std::vector<std::string> &vec) { - std::string str; - - for (const auto &e : vec) { - str += e; - } - - return str; - } - - bool string_contains_sql_injection(const std::string &input) { - std::string forbidden_strings[] = {";", "--", "'", "\"", - "/*", "*/", "xp_", "exec", - "sp_", "insert", "select", "delete"}; - - for (const auto &str : forbidden_strings) { - if (input.find(str) != std::string::npos) { - return true; - } - } - - return false; - } - } - } -} |
