| 1032 | } |
| 1033 | |
| 1034 | static bool IsDigit(const std::string& str) |
| 1035 | { |
| 1036 | if (str.empty()) |
| 1037 | { |
| 1038 | return false; |
| 1039 | } |
| 1040 | |
| 1041 | std::string::const_iterator start = str.begin(); |
| 1042 | if (*start == '-') |
| 1043 | { |
| 1044 | ++start; |
| 1045 | } |
| 1046 | |
| 1047 | return (std::all_of(start, str.end(), [](unsigned char c) { return isdigit(c); })); |
| 1048 | } |
| 1049 | |
| 1050 | // URL encode & decode |
| 1051 | static bool URLEncode(const char* url, size_t url_len, char* edcoded_url, size_t& edcoded_url_len) |