Skip to content

Commit

Permalink
use std::transform
Browse files Browse the repository at this point in the history
  • Loading branch information
ToeKneeRED committed Jan 7, 2025
1 parent 35f8701 commit 4133cb7
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions Code/components/console/ConsoleRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,8 @@ CommandBase* ConsoleRegistry::FindCommand(const char* acName)
TiltedPhoques::String findName(acName);
TiltedPhoques::String settingName(apCommand->m_name);

for (char& c : findName)
{
c = std::tolower(static_cast<unsigned char>(c));
}

for (char& c : settingName)
{
c = std::tolower(static_cast<unsigned char>(c));
}
std::transform(findName.begin(), findName.end(), findName.begin(), [](unsigned char c) { return std::tolower(c); });
std::transform(settingName.begin(), settingName.end(), settingName.begin(), [](unsigned char c) { return std::tolower(c); });

return std::strcmp(settingName.c_str(), findName.c_str()) == 0;
});
Expand All @@ -217,15 +210,8 @@ SettingBase* ConsoleRegistry::FindSetting(const char* acName)
TiltedPhoques::String findName(acName);
TiltedPhoques::String settingName(apSetting->name);

for (char& c : findName)
{
c = std::tolower(static_cast<unsigned char>(c));
}

for (char& c : settingName)
{
c = std::tolower(static_cast<unsigned char>(c));
}
std::transform(findName.begin(), findName.end(), findName.begin(), [](unsigned char c) { return std::tolower(c); });
std::transform(settingName.begin(), settingName.end(), settingName.begin(), [](unsigned char c) { return std::tolower(c); });

return std::strcmp(settingName.c_str(), findName.c_str()) == 0;
});
Expand Down

0 comments on commit 4133cb7

Please sign in to comment.