in torchaudio/csrc/decoder/src/dictionary/String.cpp [60:81]
static std::vector<std::string> splitImpl(
const Delim& delim,
std::string::size_type delimSize,
const std::string& input,
bool ignoreEmpty = false) {
std::vector<std::string> result;
std::string::size_type i = 0;
while (true) {
auto j = Any ? input.find_first_of(delim, i) : input.find(delim, i);
if (j == std::string::npos) {
break;
}
if (!(ignoreEmpty && i == j)) {
result.emplace_back(input.begin() + i, input.begin() + j);
}
i = j + delimSize;
}
if (!(ignoreEmpty && i == input.size())) {
result.emplace_back(input.begin() + i, input.end());
}
return result;
}