28 #ifndef WEBSOCKETPP_UTILITIES_IMPL_HPP
29 #define WEBSOCKETPP_UTILITIES_IMPL_HPP
34 namespace websocketpp {
37 inline std::string to_lower(std::string
const & in) {
39 std::transform(out.begin(),out.end(),out.begin(),::tolower);
43 inline std::string to_hex(std::string
const & input) {
45 std::string hex =
"0123456789ABCDEF";
47 for (size_t i = 0; i < input.size(); i++) {
48 output += hex[(input[i] & 0xF0) >> 4];
49 output += hex[input[i] & 0x0F];
56 inline std::string to_hex(uint8_t
const * input, size_t length) {
58 std::string hex =
"0123456789ABCDEF";
60 for (size_t i = 0; i < length; i++) {
61 output += hex[(input[i] & 0xF0) >> 4];
62 output += hex[input[i] & 0x0F];
69 inline std::string to_hex(
const char* input,size_t length) {
70 return to_hex(
reinterpret_cast<
const uint8_t*>(input),length);
73 inline std::string string_replace_all(std::string subject, std::string
const &
74 search, std::string
const & replace)
77 while((pos = subject.find(search, pos)) != std::string::npos) {
78 subject.replace(pos, search.length(), replace);
79 pos += replace.length();