sdl_runtime_compiler git · main
SDL3 game for running and compiling code at runtime
C++ 72.3% C 26.2%git clone https://git.christianimmanuel.de/sdl-graphics/sdl_runtime_compiler.gitwget https://git.christianimmanuel.de/sdl-graphics/sdl_runtime_compiler/archive/sdl_runtime_compiler.tar.gzsrc/levels/level.cpp raw
#include <cctype>
#include "level.hpp"
namespace
Nimbin
{
namespace
Level
{
namespace
Check
{
std::string
normalize(const std::string& s)
{
std::string out;
out.reserve(s.size());
bool last_space = true;
for (char c : s) {
if (std::isspace(static_cast<unsigned char>(c))) {
if (!last_space) {
out += ' ';
last_space = true;
}
}
else {
out += c;
last_space = false;
}
}
if (!out.empty() && out.back() == ' ')
out.pop_back();
return out;
}
bool
contains_Pattern(const std::string& haystack, const std::string& needle)
{
if (needle.empty()) return true;
std::string norm_needle = normalize(needle);
return haystack.find(norm_needle) != std::string::npos;
}
} // namespace Check
} // namespace Level
} // namespace Nimbin