[Code] Cleanup Strings Header (#4950)

* [Code] Cleanup Strings Header

* Include optimize
This commit is contained in:
Chris Miles
2025-06-22 13:52:13 -05:00
committed by GitHub
parent f0c041e8b3
commit 5ac9dd04e4
9 changed files with 204 additions and 221 deletions
+14
View File
@@ -708,6 +708,20 @@ const std::string Database::GetNPCNameByID(uint32 npc_id)
return e.id ? e.name : std::string();
}
template<typename InputIterator, typename OutputIterator>
inline auto CleanMobName(InputIterator first, InputIterator last, OutputIterator result)
{
for (; first != last; ++first) {
if (*first == '_') {
*result = ' ';
}
else if (isalpha(*first) || *first == '`') {
*result = *first;
}
}
return result;
}
const std::string Database::GetCleanNPCNameByID(uint32 npc_id)
{
const auto& e = NpcTypesRepository::FindOne(*this, npc_id);