Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

how to tokenize a string in c++11

std::vector<std::string> split(const string& input, const string& regex) {
    // passing -1 as the submatch index parameter performs splitting
    std::regex re(regex);
    std::sregex_token_iterator
        first{input.begin(), input.end(), re, -1},
        last;
    return {first, last};
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #tokenize #string
ADD COMMENT
Topic
Name
4+1 =