1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Merge 2.0release

This commit is contained in:
winlin 2018-11-27 21:24:51 +08:00
commit ba4ef34d27
13 changed files with 121 additions and 21 deletions

View file

@ -303,7 +303,7 @@ string srs_string_trim_end(string str, string trim_chars)
ret.erase(ret.end() - 1);
// ok, matched, should reset the search
i = 0;
i = -1;
}
}
@ -321,7 +321,7 @@ string srs_string_trim_start(string str, string trim_chars)
ret.erase(ret.begin());
// ok, matched, should reset the search
i = 0;
i = -1;
}
}
@ -340,7 +340,7 @@ string srs_string_remove(string str, string remove_chars)
it = ret.erase(it);
// ok, matched, should reset the search
i = 0;
i = -1;
} else {
++it;
}
@ -350,6 +350,32 @@ string srs_string_remove(string str, string remove_chars)
return ret;
}
string srs_erase_first_substr(string str, string erase_string)
{
std::string ret = str;
size_t pos = ret.find(erase_string);
if (pos != std::string::npos)
{
ret.erase(pos, erase_string.length());
}
return ret;
}
string srs_erase_last_substr(string str, string erase_string)
{
std::string ret = str;
size_t pos = ret.rfind(erase_string);
if (pos != std::string::npos)
{
ret.erase(pos, erase_string.length());
}
return ret;
}
bool srs_string_ends_with(string str, string flag)
{
const size_t pos = str.rfind(flag);