mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-12 18:42:36 +01:00
18 lines
410 B
C++
18 lines
410 B
C++
#include <cassert>
|
|
#include <string>
|
|
#include <string_view>
|
|
|
|
inline std::string StringFromHex(const std::string_view& input)
|
|
{
|
|
assert((input.size() & 1) == 0);
|
|
|
|
std::string result;
|
|
result.reserve(input.size() / 2);
|
|
for (size_t i = 0; i < input.size(); i += 2)
|
|
{
|
|
auto val = std::stoi(std::string(input.substr(i, 2)), 0, 16);
|
|
result.push_back(val);
|
|
}
|
|
return result;
|
|
}
|