merge from hugo, add parsing requests and wip cgi
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
|
||||
std::vector<std::string> split(std::string input, char delimiter)
|
||||
{
|
||||
std::vector<std::string> answer;
|
||||
std::stringstream ss(input);
|
||||
std::string temp;
|
||||
std::vector<std::string> answer;
|
||||
std::stringstream ss(input);
|
||||
std::string temp;
|
||||
|
||||
while (getline(ss, temp, delimiter))
|
||||
answer.push_back(temp);
|
||||
@@ -13,6 +13,22 @@ std::vector<std::string> split(std::string input, char delimiter)
|
||||
return answer;
|
||||
}
|
||||
|
||||
std::string trim(std::string str, char c)
|
||||
{
|
||||
str = str.substr(str.find_first_not_of(c));
|
||||
str = str.substr(0, str.find_last_not_of(c) + 1);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string itos(int n)
|
||||
{
|
||||
std::stringstream strs;
|
||||
|
||||
strs << n;
|
||||
return ( strs.str() );
|
||||
}
|
||||
|
||||
bool isNumeric(std::string str)
|
||||
{
|
||||
for (size_t i = 0; i < str.length(); i++)
|
||||
@@ -23,7 +39,6 @@ bool isNumeric(std::string str)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool isNumeric_btw(int low, int high, std::string str)
|
||||
{
|
||||
for (size_t i = 0; i < str.length(); i++)
|
||||
@@ -37,11 +52,3 @@ bool isNumeric_btw(int low, int high, std::string str)
|
||||
return true;
|
||||
}
|
||||
|
||||
char* itoa(int n)
|
||||
{
|
||||
std::stringstream strs;
|
||||
|
||||
strs << n;
|
||||
// casts : https://stackoverflow.com/questions/332030/when-should-static-cast-dynamic-cast-const-cast-and-reinterpret-cast-be-used
|
||||
return ( const_cast<char*>( strs.str().c_str() ) );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user