You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
411 B
22 lines
411 B
#ifndef STRING_UTIL_H |
|
#define STRING_UTIL_H |
|
|
|
#include <iomanip> // std::setfill, std::setw |
|
#include <sstream> // std::stringstream |
|
|
|
namespace Inferno { |
|
|
|
template<typename T> |
|
std::string intToHex(T i) |
|
{ |
|
std::stringstream stream; |
|
stream << "0x" |
|
<< std::setfill('0') << std::setw(sizeof(T) * 2) |
|
<< std::hex << i; |
|
|
|
return stream.str(); |
|
} |
|
|
|
} // namespace Inferno |
|
|
|
#endif // STRING_UTIL_H
|
|
|