38split_first(
const std::string &
s, std::string &lhs, std::string &rhs,
char c)
40 std::string::size_type
offset =
s.find(
c);
41 if (
offset == std::string::npos) {
53split_last(
const std::string &
s, std::string &lhs, std::string &rhs,
char c)
55 std::string::size_type
offset =
s.rfind(
c);
56 if (
offset == std::string::npos) {
71 std::string::size_type first = 0;
72 std::string::size_type last =
s.find_first_of(
token);
77 if (
ignore && last == first) {
79 last =
s.find_first_of(
token, ++first);
81 if (last == std::string::npos) {
82 if (first !=
s.size())
83 v.push_back(
s.substr(first));
88 while (last != std::string::npos) {
89 v.push_back(
s.substr(first, last - first));
92 first =
s.find_first_not_of(
token, last + 1);
94 if (first == std::string::npos)
99 last =
s.find_first_of(
token, first);
102 v.push_back(
s.substr(first));
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
static void ignore(const char *expr)
void tokenize(std::vector< std::string > &v, const std::string &s, char token, bool ignore)
bool split_last(const std::string &s, std::string &lhs, std::string &rhs, char c)
bool split_first(const std::string &s, std::string &lhs, std::string &rhs, char c)