We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 74c7764 commit f44cac4Copy full SHA for f44cac4
src/util/dstring.h
@@ -90,6 +90,22 @@ class dstringt final
90
return no==0; // string 0 is exactly the empty string
91
}
92
93
+ /// equivalent of as_string().starts_with(s)
94
+ bool starts_with(const char *s)
95
+ {
96
+ for(const char *t = c_str(); *s != 0; s++, t++)
97
+ if(*t != *s)
98
+ return false;
99
+
100
+ return true;
101
+ }
102
103
104
+ bool starts_with(const std::string &prefix)
105
106
+ return as_string().compare(0, prefix.size(), prefix) == 0;
107
108
109
char operator[](size_t i) const
110
{
111
return as_string()[i];
0 commit comments