Fix upper-case input file names when reading puzzle data
This commit is contained in:
parent
4d58746c6d
commit
37d60d01ed
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <aoc/framework/Solver.hpp>
|
#include <aoc/framework/Solver.hpp>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
template <typename T1, typename T2>
|
template <typename T1, typename T2>
|
||||||
@ -54,10 +55,7 @@ template <typename T1, typename T2>
|
|||||||
std::string Solver<T1, T2>::clean(const std::string& original) const
|
std::string Solver<T1, T2>::clean(const std::string& original) const
|
||||||
{
|
{
|
||||||
std::string cleaned{ original };
|
std::string cleaned{ original };
|
||||||
size_t start_pos = 0;
|
std::transform(cleaned.begin(), cleaned.end(), cleaned.begin(),
|
||||||
while ((start_pos = cleaned.find(" ", start_pos)) != std::string::npos)
|
[](unsigned char c) { return c == ' ' ? '_' : std::tolower(c); });
|
||||||
{
|
|
||||||
cleaned.replace(start_pos, 1, "_");
|
|
||||||
}
|
|
||||||
return cleaned;
|
return cleaned;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user