mirror of
https://github.com/textmate/textmate.git
synced 2026-01-22 21:27:56 -05:00
18 lines
412 B
C++
18 lines
412 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 = "";
|
|
iterate(ch, src)
|
|
{
|
|
if(strchr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.!~*'()", *ch) || excl.find(*ch) != std::string::npos)
|
|
res += *ch;
|
|
else res += text::format("%%%02X", *ch);
|
|
}
|
|
return res;
|
|
}
|
|
|
|
} /* encode */ |