NK92 - Search crawling

Do a Log for now.
This commit is contained in:
emerycp
2023-08-01 11:57:26 -04:00
parent 6f2e13e72f
commit 6e38bf2c24
4 changed files with 25 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
#include "String.h"
#include <iostream>
#include <regex>
#include <sstream>
namespace Nuake
@@ -36,6 +37,18 @@ namespace Nuake
return result;
}
std::string String::Sanitize(const std::string& keyword) {
std::string sanitizedKeyword = keyword;
// Remove spaces, underscores, and hyphens using regex
sanitizedKeyword = std::regex_replace(sanitizedKeyword, std::regex("[ _-]+"), "");
// Convert to lowercase
std::transform(sanitizedKeyword.begin(), sanitizedKeyword.end(), sanitizedKeyword.begin(), ::tolower);
return sanitizedKeyword;
}
std::vector<std::string> String::Split(const std::string& string, char delimiter)
{
std::vector<std::string> result;