|
|
|
@ -54,6 +54,10 @@ uint64_t GetTimeUs() {
|
|
|
|
|
|
|
|
|
|
std::string RemoveSubStr(const std::string &from, const std::string &sub_str, RemoveSubStrMode mode) {
|
|
|
|
|
std::string result = from;
|
|
|
|
|
if (from.empty()) {
|
|
|
|
|
MS_LOG(ERROR) << "string is empty";
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
if (mode == PREFIX) {
|
|
|
|
|
if (from.substr(0, sub_str.length()) == sub_str) {
|
|
|
|
|
result = from.substr(sub_str.size());
|
|
|
|
@ -73,6 +77,10 @@ std::string RemoveSubStr(const std::string &from, const std::string &sub_str, Re
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<std::string> StrSplit(const std::string &str, const std::string &pattern) {
|
|
|
|
|
if (str.empty()) {
|
|
|
|
|
MS_LOG(ERROR) << "string is empty";
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
std::string::size_type pos;
|
|
|
|
|
std::vector<std::string> result;
|
|
|
|
|
std::string tmpStr(str + pattern);
|
|
|
|
@ -95,6 +103,11 @@ std::vector<std::string> Tokenize(const std::string &src, const std::string &del
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (src.empty()) {
|
|
|
|
|
MS_LOG(ERROR) << "string is empty";
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<std::string> tokens;
|
|
|
|
|
size_t offset = 0;
|
|
|
|
|
|
|
|
|
|