Add cli character:copy-character and #copycharacter

This commit is contained in:
Akkadius
2020-07-18 21:07:22 -05:00
parent 880b19cc7f
commit 2e0c892b07
8 changed files with 270 additions and 18 deletions
+18 -1
View File
@@ -35,7 +35,7 @@
#define va_copy(d,s) ((d) = (s))
#endif
// original source:
// original source:
// https://github.com/facebook/folly/blob/master/folly/String.cpp
//
const std::string vStringFormat(const char* format, va_list args)
@@ -144,6 +144,23 @@ std::string implode(std::string glue, std::vector<std::string> src)
return final_output;
}
std::vector<std::string> wrap(std::vector<std::string> &src, std::string character)
{
std::vector<std::string> new_vector;
new_vector.reserve(src.size());
for (auto &e: src) {
if (e == "null") {
new_vector.emplace_back(e);
continue;
}
new_vector.emplace_back(character + e + character);
}
return new_vector;
}
std::string EscapeString(const std::string &s) {
std::string ret;