Lines Matching refs:str
17 bool StringUtils::EndsWith(const std::string& str, const std::string& postfix) in EndsWith() argument
19 if (str.size() < postfix.size()) { in EndsWith()
22 return str.compare(str.size() - postfix.size(), postfix.size(), postfix) == 0; in EndsWith()
25 bool StringUtils::StartsWith(const std::string& str, const std::string& prefix) in StartsWith() argument
27 if (str.size() < prefix.size()) { in StartsWith()
30 return str.compare(0, prefix.size(), prefix) == 0; in StartsWith()
33 bool StringUtils::Contains(const std::string& str, const std::string& target) in Contains() argument
35 return str.find(target) != std::string::npos; in Contains()
38 std::string StringUtils::Strip(const std::string& str) in Strip() argument
42 auto first = str.find_first_not_of(blanks); in Strip()
47 auto last = str.find_last_not_of(blanks); in Strip()
51 return str.substr(first, last - first + 1); in Strip()
67 std::vector<std::string> StringUtils::Split(const std::string& str, const std::string& sep) in Split() argument
70 if (str.empty() || sep.empty() || str.size() < sep.size()) { in Split()
75 while (start < str.size()) { in Split()
76 pos = str.find(sep, start); in Split()
78 result.push_back(str.substr(start, pos - start)); in Split()
82 result.push_back(str.substr(start)); in Split()