Lines Matching refs:s

31 std::vector<std::string> Split(const std::string& s,  in Split()  argument
40 found = s.find_first_of(delimiters, base); in Split()
41 result.push_back(s.substr(base, found - base)); in Split()
42 if (found == s.npos) break; in Split()
49 std::string Trim(const std::string& s) { in Trim() argument
52 if (s.size() == 0) { in Trim()
57 size_t end_index = s.size() - 1; in Trim()
60 while (start_index < s.size()) { in Trim()
61 if (!isspace(s[start_index])) { in Trim()
69 if (!isspace(s[end_index])) { in Trim()
80 return s.substr(start_index, end_index - start_index + 1); in Trim()
90 bool StartsWith(std::string_view s, std::string_view prefix) { in StartsWith() argument
91 return s.substr(0, prefix.size()) == prefix; in StartsWith()
94 bool StartsWith(std::string_view s, char prefix) { in StartsWith() argument
95 return !s.empty() && s.front() == prefix; in StartsWith()
98 bool StartsWithIgnoreCase(std::string_view s, std::string_view prefix) { in StartsWithIgnoreCase() argument
99 return s.size() >= prefix.size() && strncasecmp(s.data(), prefix.data(), prefix.size()) == 0; in StartsWithIgnoreCase()
102 bool EndsWith(std::string_view s, std::string_view suffix) { in EndsWith() argument
103 return s.size() >= suffix.size() && s.substr(s.size() - suffix.size(), suffix.size()) == suffix; in EndsWith()
106 bool EndsWith(std::string_view s, char suffix) { in EndsWith() argument
107 return !s.empty() && s.back() == suffix; in EndsWith()
110 bool EndsWithIgnoreCase(std::string_view s, std::string_view suffix) { in EndsWithIgnoreCase() argument
111 return s.size() >= suffix.size() && in EndsWithIgnoreCase()
112 strncasecmp(s.data() + (s.size() - suffix.size()), suffix.data(), suffix.size()) == 0; in EndsWithIgnoreCase()
119 std::string StringReplace(std::string_view s, std::string_view from, std::string_view to, in StringReplace() argument
121 if (from.empty()) return std::string(s); in StringReplace()
126 std::string_view::size_type pos = s.find(from, start_pos); in StringReplace()
129 result.append(s.data() + start_pos, pos - start_pos); in StringReplace()
134 result.append(s.data() + start_pos, s.size() - start_pos); in StringReplace()