trim_ws, too

This commit is contained in:
AnyOldName3 2025-01-17 01:21:24 +00:00
parent 88fe079f95
commit e345fca99a

View File

@ -11,6 +11,23 @@
namespace sfs = std::filesystem;
namespace
{
// from configfileparser.cpp
std::string trim_ws(const std::string& s)
{
std::string::size_type n, n2;
n = s.find_first_not_of(" \t\r\n");
if (n == std::string::npos)
return std::string();
else
{
n2 = s.find_last_not_of(" \t\r\n");
return s.substr(n, n2 - n + 1);
}
}
}
MwIniImporter::MwIniImporter()
: mVerbose(false)
, mEncoding(ToUTF8::WINDOWS_1250)
@ -371,6 +388,8 @@ MwIniImporter::multistrmap MwIniImporter::loadCfgFile(const std::filesystem::pat
std::string key(line.substr(0, pos));
std::string value(line.substr(pos + 1));
key = trim_ws(key);
value = trim_ws(key);
if (map.find(key) == map.end())
{