-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Add this method in CSVColumn:
std::string CSVColumn::get_stripped_value(const char quote) const
{
const std::string& str = this->get_value();
if (str.empty())
return std::string{};
// if the quote is not present on both sides, return the string as is
// (although, this is almost surely a cause of another problem)
if (str[0] != quote && str[str.length() - 1] != quote)
return str;
std::string stripped_str;
for (std::size_t i = 1; i < str.length() - 1; ++i)
stripped_str.push_back(str[i]);
return stripped_str;
}Replace CSVReader::get_and_strip_column with:
std::string CSVReader::get_and_strip_column(const std::size_t idx) const
{
if (idx >= this->m_columns.size())
return std::string{};
return this->m_columns[idx].get_stripped_value(this->m_quote);
}Metadata
Metadata
Assignees
Labels
No labels