+#include "utils.h"
#include <algorithm>
#include <msp/strings/format.h>
#include <msp/strings/regex.h>
#include <msp/strings/utils.h>
-#include "utils.h"
using namespace std;
str += url.scheme+"://";
str += url.host;
str += urlencode(url.path);
- if(!url.query.empty())
- {
- str += '?';
- str += url.query;
- }
- if(!url.fragment.empty())
- {
- str += '#';
- str += url.fragment;
- }
+ append(str, "?", url.query);
+ append(str, "#", url.fragment);
return str;
}
string str;
for(const auto &kvp: query)
{
- if(!str.empty())
- str += '&';
- str += urlencode_plus(kvp.first);
+ append(str, "&", urlencode_plus(kvp.first));
str += '=';
str += urlencode_plus(kvp.second);
}