tahamajs/OS / Files /past_terms /Operating-System-Course-Projects /2.Map-Reduce-Genre-Counter /src /utils.cpp
| void ltrim(std::string& s) { | |
| s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) { | |
| return !std::isspace(ch); | |
| })); | |
| } | |
| void rtrim(std::string& s) { | |
| s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char ch) { | |
| return !std::isspace(ch); | |
| }).base(), | |
| s.end()); | |
| } | |
| void trim(std::string& s) { | |
| rtrim(s); | |
| ltrim(s); | |
| } | |
| std::vector<std::string> split_line(const std::string& line, char delim) { | |
| std::vector<std::string> result; | |
| std::istringstream line_stream(line); | |
| while (!line_stream.eof()) { | |
| std::string temp; | |
| std::getline(line_stream, temp, delim); | |
| trim(temp); | |
| result.push_back(temp); | |
| } | |
| return result; | |
| } | |
Xet Storage Details
- Size:
- 893 Bytes
- Xet hash:
- d0224a30f1c77ee926d9e8c38981a497949bc0ca9e9c43d0c2aef6086da643b1
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.