#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;
}
