Files
dota_factory/src/lib/core/DisplayName.cpp
2026-06-13 14:19:51 +02:00

28 lines
524 B
C++

#include "DisplayName.h"
#include <cctype>
std::string toDisplayName(const std::string& id)
{
std::string result;
bool nextUpper = true;
for (char c : id)
{
if (c == '_')
{
result += ' ';
nextUpper = true;
}
else if (nextUpper)
{
result += static_cast<char>(std::toupper(static_cast<unsigned char>(c)));
nextUpper = false;
}
else
{
result += c;
}
}
return result;
}