Eliya/src/Utils/Utils.cpp

18 lines
401 B
C++
Raw Normal View History

2020-04-03 13:26:16 +02:00
//
// Created by versustune on 23.02.20.
//
#include "Utils.h"
std::string Utils::stringToHex(const std::string &input) {
static const char hex_digits[] = "0123456789ABCDEF";
std::string output;
output.reserve(input.length() * 2);
for (unsigned char c : input) {
output.push_back(hex_digits[c >> 4]);
output.push_back(hex_digits[c & 15]);
}
return output;
}