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

add ignoring _definst_ at the end of app (#1261)

This commit is contained in:
MakarovYaroslav 2018-11-11 08:31:29 +03:00 committed by winlin
parent b2066cbf68
commit e62ac29f48
5 changed files with 55 additions and 0 deletions

View file

@ -269,6 +269,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)
{
return str.rfind(flag) == str.length() - flag.length();