Skip to content

Instantly share code, notes, and snippets.

@ch-hristov
Created November 5, 2015 20:18
Show Gist options
  • Select an option

  • Save ch-hristov/a4a6ca3b384a06a18add to your computer and use it in GitHub Desktop.

Select an option

Save ch-hristov/a4a6ca3b384a06a18add to your computer and use it in GitHub Desktop.

Revisions

  1. ch-hristov renamed this gist Nov 5, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. ch-hristov created this gist Nov 5, 2015.
    12 changes: 12 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    std::vector<std::string> split(const std::string &text, char sep) {
    std::vector<std::string> tokens;
    int start = 0, end = 0;
    while ((end = text.find(sep, start)) != std::string::npos) {
    tokens.push_back(text.substr(start, end - start));
    start = end + 1;
    }
    tokens.push_back(text.substr(start));
    return tokens;
    }

    //link http://stackoverflow.com/a/7408245/4487530