mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 16:47:37 +00:00
Move string split to misc
This commit is contained in:
+14
@@ -30,6 +30,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
@@ -273,6 +274,19 @@ namespace Algo {
|
|||||||
for (uint64_t i = 0; i < size; ++i)
|
for (uint64_t i = 0; i < size; ++i)
|
||||||
std::swap(buf[i], buf[prng.rand(size - i) + i]);
|
std::swap(buf[i], buf[prng.rand(size - i) + i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// split the string
|
||||||
|
inline std::vector<std::string> split(const std::string& input, char delimiter) {
|
||||||
|
std::istringstream stream(input);
|
||||||
|
std::string field;
|
||||||
|
std::vector<std::string> fields;
|
||||||
|
|
||||||
|
while (std::getline(stream, field, delimiter)) {
|
||||||
|
fields.push_back(field);
|
||||||
|
}
|
||||||
|
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user