Merge branch 'string_utils' into tool-call
This commit is contained in:
commit
e211629b89
1 changed files with 4 additions and 4 deletions
|
@ -496,19 +496,19 @@ std::string string_join(const std::vector<std::string> & values, const std::stri
|
|||
}
|
||||
|
||||
std::vector<std::string> string_split(const std::string & str, const std::string & delimiter) {
|
||||
std::vector<std::string> tokens;
|
||||
std::vector<std::string> parts;
|
||||
size_t start = 0;
|
||||
size_t end = str.find(delimiter);
|
||||
|
||||
while (end != std::string::npos) {
|
||||
tokens.push_back(str.substr(start, end - start));
|
||||
parts.push_back(str.substr(start, end - start));
|
||||
start = end + delimiter.length();
|
||||
end = str.find(delimiter, start);
|
||||
}
|
||||
|
||||
tokens.push_back(str.substr(start));
|
||||
parts.push_back(str.substr(start));
|
||||
|
||||
return tokens;
|
||||
return parts;
|
||||
}
|
||||
|
||||
std::string string_repeat(const std::string & str, size_t n) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue