MCPcopy Create free account
hub / github.com/Tablecruncher/tablecruncher / vec2string

Method vec2string

src/csvtable.cpp:1135–1157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1133
1134
1135std::string CsvTable::vec2string(const std::vector<std::string> &line, CsvDefinition definition) {
1136 std::stringstream ret;
1137 size_t cellLength;
1138 for( size_t i = 0; i != line.size(); ++i) {
1139 if( toBeQuoted(line.at(i), definition ) ) {
1140 cellLength = line.at(i).length();
1141 ret << definition.quote;
1142 for( size_t j = 0; j < cellLength; ++j ) {
1143 if( line.at(i).at(j) == definition.quote ) {
1144 ret << definition.quote;
1145 }
1146 ret << line.at(i).at(j);
1147 }
1148 ret << definition.quote;
1149 } else {
1150 ret << line.at(i);
1151 }
1152 if( i < line.size()-1 ) {
1153 ret << definition.delimiter;
1154 }
1155 }
1156 return ret.str();
1157}
1158
1159
1160// returns true if field has to be quoted

Callers

nothing calls this directly

Calls 2

atMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected