28#ifndef WEBSOCKETPP_UTILITIES_IMPL_HPP
29#define WEBSOCKETPP_UTILITIES_IMPL_HPP
37inline std::string
to_lower(std::string
const & in) {
39 std::transform(out.begin(),out.end(),out.begin(),::tolower);
43inline 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];
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];
69inline std::string
to_hex(
const char* input,
size_t length) {
70 return to_hex(
reinterpret_cast<const uint8_t*
>(input),length);
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();
std::string to_hex(std::string const &input)
Convert std::string to ascii printed string of hex digits.
std::string string_replace_all(std::string subject, std::string const &search, std::string const &replace)
Replace all occurrances of a substring with another.
std::string to_lower(std::string const &in)
Convert a string to lowercase.
Namespace for the WebSocket++ project.