This commit is contained in:
root
2024-04-30 03:01:48 +08:00
parent 9abf8aa3a4
commit 47be0adc6b
330 changed files with 5549 additions and 39399 deletions

View File

@@ -85,6 +85,31 @@ void Tool::Logger(std::string L)
#endif
}
void Tool::Split(const std::string &src, std::vector<std::string> &dest, const std::string &separator)
{
std::string str = src;
std::string substring;
std::string::size_type start = 0, index;
dest.clear();
index = str.find_first_of(separator, start);
do
{
if (index != std::string::npos)
{
substring = str.substr(start, index - start);
dest.push_back(substring);
start = index + separator.size();
index = str.find(separator, start);
if (start == std::string::npos)
break;
}
} while (index != std::string::npos);
// the last part
substring = str.substr(start);
dest.push_back(substring);
}
long long Tool::get_cur_time()
{
// 获取操作系统当前时间点(精确到微秒)