Overhaul of command parsing
This commit is contained in:
@@ -142,6 +142,16 @@ StringVec split(const std::string &s, char sep) {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string join(const StringVec &strs, const std::string &sep) {
|
||||
if (strs.empty()) return "";
|
||||
std::ostringstream oss;
|
||||
oss << strs[0];
|
||||
for (int i = 1; i < strs.size(); i++) {
|
||||
oss << sep << strs[i];
|
||||
}
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
std::string repeat_string(const std::string &a, int n) {
|
||||
int len = a.size();
|
||||
std::string result(len * n, ' ');
|
||||
|
||||
Reference in New Issue
Block a user