+vector<string> String::split(char sep) const {
+ vector<string> v;
+ String::size_type start = 0;
+ String::size_type end = find(sep);
+ while (end != String::npos) {
+ v.push_back(substr(start, end - start));
+ start = end + 1;
+ end = find(sep, start);
+ }
+ if (start != length()) {
+ v.push_back(substr(start, end - start));
+ }
+ return v;
+}
+
+String String::join(const vector<string>& v, const string& sep) {
+ stringstream ss;
+ std::copy(v.begin(), v.end(), ostream_iterator<string>(ss, sep.c_str()));
+ return ss.str();
+}
+