66bool AutoDecodeCSV(
const wxString& aInput, std::vector<std::vector<wxString>>& aData )
69 bool trimCells =
true;
70 bool skipCommentLines =
true;
71 bool skipEmptyLines =
true;
72 char commentPrefix =
'#';
76 if( aInput.find(
'\t' ) != std::string::npos )
81 std::istringstream inputStream( aInput.ToStdString() );
83 rapidcsv::Document doc( inputStream, rapidcsv::LabelParams( -1, -1 ),
84 rapidcsv::SeparatorParams( delimiter, trimCells ), rapidcsv::ConverterParams(),
85 rapidcsv::LineReaderParams( skipCommentLines, commentPrefix, skipEmptyLines ) );
90 for(
size_t i = 0; i < doc.GetRowCount(); ++i )
92 std::vector<wxString>& row = aData.emplace_back();
93 for(
size_t j = 0; j < doc.GetColumnCount(); ++j )
95 std::string cell = doc.GetCell<std::string>( j, i );
96 row.emplace_back( cell );
101 return aData[0].size() > 0;
bool AutoDecodeCSV(const wxString &aInput, std::vector< std::vector< wxString > > &aData)
Try to guess the format of a T/CSV file and decode it into aData.