Make some changes
This commit is contained in:
@@ -113,4 +113,47 @@ void print_sp_matrix_structure(const arma::sp_cx_mat &A)
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
std::vector<std::string> split(const std::string &s, char delim) {
|
||||
std::vector<std::string> result;
|
||||
std::stringstream ss(s);
|
||||
std::string item;
|
||||
|
||||
while (getline(ss, item, delim)) {
|
||||
result.push_back(trim(item));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
inline std::string& ltrim(std::string& s, const char* t)
|
||||
{
|
||||
s.erase(0, s.find_first_not_of(t));
|
||||
return s;
|
||||
}
|
||||
|
||||
inline std::string& rtrim(std::string& s, const char* t)
|
||||
{
|
||||
s.erase(s.find_last_not_of(t) + 1);
|
||||
return s;
|
||||
}
|
||||
|
||||
inline std::string& trim(std::string& s, const char* t)
|
||||
{
|
||||
return ltrim(rtrim(s, t), t);
|
||||
}
|
||||
|
||||
inline std::string ltrim_copy(std::string s, const char* t)
|
||||
{
|
||||
return ltrim(s, t);
|
||||
}
|
||||
|
||||
inline std::string rtrim_copy(std::string s, const char* t)
|
||||
{
|
||||
return rtrim(s, t);
|
||||
}
|
||||
|
||||
inline std::string trim_copy(std::string s, const char* t)
|
||||
{
|
||||
return trim(s, t);
|
||||
}
|
||||
} // namespace utils
|
||||
|
||||
Reference in New Issue
Block a user