summaryrefslogtreecommitdiff
path: root/src/emscripten-optimizer
diff options
context:
space:
mode:
Diffstat (limited to 'src/emscripten-optimizer')
-rw-r--r--src/emscripten-optimizer/istring.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/emscripten-optimizer/istring.h b/src/emscripten-optimizer/istring.h
index b991159e5..74b2c1e4b 100644
--- a/src/emscripten-optimizer/istring.h
+++ b/src/emscripten-optimizer/istring.h
@@ -136,6 +136,15 @@ struct IString {
bool is() const { return str != nullptr; }
bool isNull() const { return str == nullptr; }
+
+ bool startsWith(const char *prefix) const {
+ const char *ptr = str;
+ while (true) {
+ if (*prefix == 0) return true;
+ if (*ptr == 0) return false;
+ if (*ptr++ != *prefix++) return false;
+ }
+ }
};
} // namespace cashew