Files
eUi/include/simpleTools/stringAlgo.h
T
2025-08-25 15:53:05 +08:00

16 lines
434 B
C++

#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