Fix a bug in function registry, improve docs

This commit is contained in:
2021-12-23 14:38:01 -05:00
parent b4639c70db
commit 82381ada2e
5 changed files with 112 additions and 41 deletions

View File

@@ -177,6 +177,24 @@ StringVec split_lines(const std::string &s) {
return result;
}
StringVec split_docstring(const std::string &s) {
StringVec result;
int start = 0;
for (int i = 0; i < int(s.size()); i++) {
if (s[i]=='|') {
int len = i-start;
if ((len > 0)||(start > 0)) {
result.push_back(s.substr(start, i-start));
}
start = i + 1;
}
}
if (start < int(s.size())) {
result.push_back(s.substr(start, s.size()-start));
}
return result;
}
std::string join(const StringVec &strs, const std::string &sep) {
if (strs.empty()) return "";
std::ostringstream oss;