wip script output verification working
+ trim secure pos segfault + concat script message with server message
This commit is contained in:
@@ -15,9 +15,19 @@ std::vector<std::string> split(std::string input, char delimiter)
|
||||
|
||||
std::string trim(std::string str, char c)
|
||||
{
|
||||
// TODO: protect substr
|
||||
str = str.substr(str.find_first_not_of(c));
|
||||
str = str.substr(0, str.find_last_not_of(c) + 1);
|
||||
size_t pos;
|
||||
|
||||
// delete leadings c
|
||||
pos = str.find_first_not_of(c);
|
||||
if (pos == std::string::npos)
|
||||
return str;
|
||||
str = str.substr(pos);
|
||||
|
||||
// delete endings c
|
||||
pos = str.find_last_not_of(c);
|
||||
if (pos == std::string::npos)
|
||||
return str;
|
||||
str = str.substr(0, pos + 1);
|
||||
|
||||
return str;
|
||||
}
|
||||
@@ -107,7 +117,7 @@ std::string str_tolower(std::string str)
|
||||
return str;
|
||||
}
|
||||
|
||||
void delete_line_in_string(std::string * str, size_t pos, std::string delim)
|
||||
void del_line_in_str(std::string * str, size_t pos, std::string delim)
|
||||
{
|
||||
size_t begin;
|
||||
size_t end;
|
||||
|
||||
Reference in New Issue
Block a user