factored out to_hex into the escape_string header file
This commit is contained in:
@@ -352,5 +352,17 @@ namespace libtorrent
|
||||
return url.substr(pos, url.find('&', pos) - pos);
|
||||
}
|
||||
|
||||
TORRENT_EXPORT std::string to_hex(std::string const& s)
|
||||
{
|
||||
std::string ret;
|
||||
char* digits = "0123456789abcdef";
|
||||
for (std::string::const_iterator i = s.begin(); i != s.end(); ++i)
|
||||
{
|
||||
ret += digits[((unsigned char)*i) >> 4];
|
||||
ret += digits[((unsigned char)*i) & 0xf];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user