1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00
This commit is contained in:
winlin 2015-12-08 18:32:37 +08:00
parent fabcc91a0e
commit 5ac8177ce6
6 changed files with 28 additions and 13 deletions

View file

@ -356,7 +356,9 @@ vector<string> srs_string_split(string str, string flag)
string s = str;
while ((pos = s.find(flag)) != string::npos) {
arr.push_back(s.substr(0, pos));
if (pos != 0) {
arr.push_back(s.substr(0, pos));
}
s = s.substr(pos + flag.length());
}
@ -406,7 +408,9 @@ vector<string> srs_string_split(string str, vector<string> flags)
break;
}
arr.push_back(s.substr(0, pos));
if (pos != 0) {
arr.push_back(s.substr(0, pos));
}
s = s.substr(pos + flag.length());
}

View file

@ -88,6 +88,8 @@ extern bool srs_string_starts_with(std::string str, std::string flag0, std::stri
extern bool srs_string_starts_with(std::string str, std::string flag0, std::string flag1, std::string flag2, std::string flag3);
// whether string contains with
extern bool srs_string_contains(std::string str, std::string flag);
// find the min match in str for flags.
extern std::string srs_string_min_match(std::string str, std::vector<std::string> flags);
// split the string by flag to array.
extern std::vector<std::string> srs_string_split(std::string str, std::string flag);
extern std::vector<std::string> srs_string_split(std::string str, std::vector<std::string> flags);
@ -97,9 +99,9 @@ extern int srs_create_dir_recursively(std::string dir);
// whether path exists.
extern bool srs_path_exists(std::string path);
// get the dirname of path, for instance, filename("/live/livestream")="/live"
// get the dirname of path, for instance, dirname("/live/livestream")="/live"
extern std::string srs_path_dirname(std::string path);
// get the basename of path, for instance, filename("/live/livestream")="livestream"
// get the basename of path, for instance, basename("/live/livestream")="livestream"
extern std::string srs_path_basename(std::string path);
// get the filename of path, for instance, filename("livestream.flv")="livestream"
extern std::string srs_path_filename(std::string path);