稳定版本备份
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
static std::vector<std::string> split(const std::string& s, char delimiter) {
|
||||
std::vector<std::string> tokens;
|
||||
std::string token;
|
||||
std::stringstream ss(s); // 创建字符串流
|
||||
|
||||
// 使用 std::getline 从字符串流中读取以分隔符分隔的子字符串
|
||||
while (std::getline(ss, token, delimiter)) {
|
||||
tokens.push_back(token);
|
||||
}
|
||||
|
||||
return tokens;
|
||||
}
|
||||
#pragma once
|
||||
Reference in New Issue
Block a user