75 std::stringstream hex_string;
76 for(
int n = 0; n < binary_data.size(); n++)
77 hex_string << std::setfill(
'0') << std::setw(2) << std::hex << (int)(binary_data[n]);
78 return hex_string.str();
88 std::stringstream out;
89 for(
int n = 0; n <
length; n++)
91 int val = (int)(binary_data[n] & 0xFF);
92 if ((val == 0x20) || (val >= 48 && val <= 57) || (val >= 65 && val <= 90) || (val >= 97 && val <= 122))
94 out << std::string(1,(
char)(val & 0xFF));
101 out <<
"\\x" << std::setfill(
'0') << std::setw(2) << std::hex << val;
114 if(!str.empty() && !from.empty())
116 size_t start_pos = 0;
117 while((start_pos = str.find(from, start_pos)) != std::string::npos)
119 str.replace(start_pos, from.length(), to);
120 start_pos += to.length();
130 replaceAll(
s,
"\n",
", ");
131 replaceAll(
s,
": , ",
": ");
132 while(
s.find(
" ") != std::string::npos)
133 replaceAll(
s,
" ",
" ");
141 std::vector<std::string> parts;
143 for(
int n = 0; n <
s.size(); n++)
147 if(!parts.back().empty())
150 parts.back().reserve(
s.size() + 1 - n);
155 parts.back().push_back(
s[n]);