MCPcopy Create free account
hub / github.com/Snapchat/Valdi / hasPrefix

Function hasPrefix

valdi_core/src/valdi_core/cpp/Attributes/AttributeUtils.cpp:166–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166bool hasPrefix(const std::string_view& str, size_t index, const char* term) {
167 if (index >= str.size()) {
168 return false;
169 }
170
171 const auto* cStr = str.data() + index;
172 const auto* current = term;
173 while (*current != '\0') {
174 if (*cStr != *current) {
175 return false;
176 }
177
178 cStr++;
179 current++;
180 }
181
182 return true;
183}
184
185bool hasSuffix(const std::string_view& str, const char* term) {
186 auto termLength = strlen(term);

Callers 2

hasPrefixMethod · 0.50
trimmedMethod · 0.50

Calls 2

sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected