MCPcopy Create free account
hub / github.com/BoevaLab/FREEC / trim

Function trim

src/ConfigFile.cpp:5–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include <fstream>
4
5std::string trim(std::string const& source, char const* delims = " \t\r\n") {
6 std::string result(source);
7 std::string::size_type index = result.find_last_not_of(delims);
8 if(index != std::string::npos)
9 result.erase(++index);
10
11 index = result.find_first_not_of(delims);
12 if(index != std::string::npos)
13 result.erase(0, index);
14 else
15 result.erase();
16 return result;
17}
18
19ConfigFile::ConfigFile(std::string const& configFile) {
20 std::ifstream file(configFile.c_str());

Callers 1

ConfigFileMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected