C++ Language

created : 2020-06-02T10:14:04+00:00
modified : 2021-04-18T11:06:33+00:00
cpp

Memory

Tips

String

  #define TRIM_SPACE "\t\n\v "
  vector<string> split(string input, char delimiter) {
    vector<string> answer;
    stringstream ss(input);
    string temp;

    while (getline(ss, temp, delimiter)) {
      answer.push_back(temp);
    }
    return answer;
  }

  string trim(string& s, const string& drop = TRIM_SPACE) {
    string r = s.erase(s.find_last_not_of(drop) + 1);
    return r.erase(0, r.find_first_not_of(drop));
  }

Time

Books