MCPcopy Create free account
hub / github.com/ceres-solver/ceres-solver / SplitStringUsingChar

Function SplitStringUsingChar

examples/nist.cc:165–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163using Matrix = Eigen::Matrix<double, Dynamic, Dynamic, RowMajor>;
164
165void SplitStringUsingChar(const std::string& full,
166 const char delim,
167 std::vector<std::string>* result) {
168 std::back_insert_iterator<std::vector<std::string>> it(*result);
169
170 const char* p = full.data();
171 const char* end = p + full.size();
172 while (p != end) {
173 if (*p == delim) {
174 ++p;
175 } else {
176 const char* start = p;
177 while (++p != end && *p != delim) {
178 // Skip to the next occurrence of the delimiter.
179 }
180 *it++ = std::string(start, p - start);
181 }
182 }
183}
184
185bool GetAndSplitLine(std::ifstream& ifs, std::vector<std::string>* pieces) {
186 pieces->clear();

Callers 1

GetAndSplitLineFunction · 0.85

Calls 2

dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected