More sketching

This commit is contained in:
Erica Fischer
2024-09-12 14:02:39 -07:00
parent b234cb9dac
commit 88f8b95f27
3 changed files with 58 additions and 10 deletions
+14
View File
@@ -341,3 +341,17 @@ std::string truncate_string(std::string const &s, size_t len) {
return s.substr(0, i);
}
bool starts_with(std::string const &s, std::string const &prefix) {
if (s.size() < prefix.size()) {
return false;
}
for (size_t i = 0; i < prefix.size(); i++) {
if (s[i] != prefix[i]) {
return false;
}
}
return true;
}