44 auto ext = std::filesystem::path(filePath).extension();
45 return ext ==
".cdf" || ext ==
".txt";
54 return std::filesystem::path(filePath).extension() ==
".raw";
62 inline std::string
strip(
const std::string& s) {
63 auto start = s.find_first_not_of(
" \t\r\n");
64 if (start == std::string::npos)
return "";
65 auto end = s.find_last_not_of(
" \t\r\n");
66 return s.substr(start, end - start + 1);
75 std::string t =
strip(s);
76 if (t.size() >= 2 && t.front() ==
'\'' && t.back() ==
'\'')
77 return strip(t.substr(1, t.size() - 2));
Collection of utility functions.
bool isCommonDataFormat(const std::string &filePath)
Check if filepath is IEEE Common Data Format.
std::string stripQuotes(const std::string &s)
Strip surrounding single quotes and whitespace from a string.
bool isRawFormat(const std::string &filePath)
Check if filepath is PSS/E Raw format.
std::string strip(const std::string &s)
Strip leading and trailing whitespace from a string.