-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.cpp
More file actions
33 lines (27 loc) · 948 Bytes
/
Copy pathutils.cpp
File metadata and controls
33 lines (27 loc) · 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "utils.hpp"
std::vector<std::string> split_string(std::string line, const char delimiter){
std::vector<std::string> strings;
std::string content;
// Iterate on strings
std::stringstream str(line);
while (std::getline(str, content, delimiter)){
strings.push_back(content);
}
return strings;
}
std::vector<std::string> split_string(std::string line, std::string delimiter){
std::vector<std::string> strings;
// TO-DO: Separate columns consisting for string delimiter
return strings;
}
std::vector<std::vector<std::string>> transpose(std::vector<std::vector<std::string>>m){
int columns = m.size();
int rows = m[0].size();
std::vector<std::vector<std::string>> transposed_m(rows, std::vector<std::string>(columns, "0"));
for (int i=0; i<rows; i++){
for (int j=0; j<columns; j++){
transposed_m[i][j] = m[j][i];
}
}
return transposed_m;
}