mirror of
https://github.com/OpenMW/openmw.git
synced 2026-02-01 21:48:26 +00:00
Offload lower casing of the patternString to splitString
This commit is contained in:
parent
39832a3e71
commit
b3111a466e
1 changed files with 3 additions and 3 deletions
|
|
@ -943,18 +943,18 @@ namespace MWGui
|
|||
|
||||
namespace
|
||||
{
|
||||
std::vector<std::string> splitString(const std::string& inputString)
|
||||
std::vector<std::string> splitString(std::string inputString)
|
||||
{
|
||||
Misc::StringUtils::lowerCaseInPlace(inputString);
|
||||
std::istringstream stringStream(inputString);
|
||||
return { std::istream_iterator<std::string>(stringStream), std::istream_iterator<std::string>() };
|
||||
}
|
||||
double weightedSearch(std::string corpus, std::string patternString)
|
||||
double weightedSearch(std::string corpus, const std::string& patternString)
|
||||
{
|
||||
if (patternString.empty() || patternString.find_first_not_of(" ") == std::string::npos)
|
||||
return 1.0;
|
||||
|
||||
Misc::StringUtils::lowerCaseInPlace(corpus);
|
||||
Misc::StringUtils::lowerCaseInPlace(patternString);
|
||||
|
||||
const std::vector<std::string> patternArray = splitString(patternString);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue