Add solution for 2015 Day 19
This commit is contained in:
1 parent
ce9bc29372
commit
9ef2809593
4 files changed
+265
-12
No files matched your search
@@ -49,9 +49,9 @@ struct Helper
|
||||
t.erase(std::remove_if(t.begin(), t.end(), func), t.end());
|
||||
}
|
||||
|
||||
static bool StartsWith(const std::string_view& str, const std::string& prefix)
|
||||
static bool StartsWith(const std::string_view& str, const std::string& prefix, size_t offset = 0)
|
||||
{
|
||||
return str.substr(0, prefix.size()) == prefix;
|
||||
return str.substr(offset, prefix.size()) == prefix;
|
||||
}
|
||||
|
||||
static bool EndsWith(const std::string_view& str, const std::string& prefix)
|
||||
@@ -59,6 +59,11 @@ struct Helper
|
||||
return str.substr(str.size() - prefix.size(), prefix.size()) == prefix;
|
||||
}
|
||||
|
||||
static void Replace(std::string& str, size_t size, const std::string& other, size_t pos)
|
||||
{
|
||||
str.replace(pos, size, other);
|
||||
}
|
||||
|
||||
static bool IsDigit(char c)
|
||||
{
|
||||
return c >= '0' && c <= '9';
|
||||
|
||||
Reference in new issue
Block a user