piece of code: Decode urls in c++


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
std::string urlDecode(std::string &eString) {
	std::string ret;
	char ch;
	int i, j;
	for (i=0; i<eString.length(); i++) {
		if (int(eString[i])==37) {
			sscanf(eString.substr(i+1,2).c_str(), "%x", &j);
			ch=static_cast<char>(j);
			ret+=ch;
			i=i+2;
		} else {
			ret+=eString[i];
		}
	}
	return (ret);
}


http://pocode.tk/decode-url/
Topic archived. No new replies allowed.