mirror of
https://github.com/open-goal/jak-project
synced 2026-05-28 08:25:56 -04:00
lsp: handle line-endings appropriately (#3318)
This commit is contained in:
@@ -102,6 +102,22 @@ std::vector<std::string> split(const ::std::string& str, char delimiter) {
|
||||
return google_diff::split_string(str, delimiter);
|
||||
}
|
||||
|
||||
std::vector<std::string> split_string(const std::string& str, const std::string& delimiter) {
|
||||
std::vector<std::string> parsed;
|
||||
std::string::size_type pos = 0;
|
||||
while (true) {
|
||||
const std::string::size_type found = str.find(delimiter, pos);
|
||||
if (found == std::string::npos) {
|
||||
parsed.push_back(str.substr(pos));
|
||||
break;
|
||||
} else {
|
||||
parsed.push_back(str.substr(pos, found - pos));
|
||||
pos = found + delimiter.length();
|
||||
}
|
||||
}
|
||||
return parsed;
|
||||
}
|
||||
|
||||
std::vector<std::string> regex_get_capture_groups(const std::string& str,
|
||||
const std::string& regex) {
|
||||
std::vector<std::string> groups;
|
||||
|
||||
Reference in New Issue
Block a user