mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
19 lines
418 B
C++
19 lines
418 B
C++
#include "encode.h"
|
|
#include "format.h"
|
|
|
|
namespace encode
|
|
{
|
|
std::string url_part (std::string const& src, std::string const& excl)
|
|
{
|
|
std::string res = "";
|
|
for(auto const& ch : src)
|
|
{
|
|
if(strchr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.!~*'()", ch) || excl.find(ch) != std::string::npos)
|
|
res += ch;
|
|
else res += text::format("%%%02X", ch);
|
|
}
|
|
return res;
|
|
}
|
|
|
|
} /* encode */
|