summaryrefslogtreecommitdiff
path: root/lib/std/hasprefix.myr
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std/hasprefix.myr')
-rw-r--r--lib/std/hasprefix.myr12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/std/hasprefix.myr b/lib/std/hasprefix.myr
new file mode 100644
index 0000000..c9749f6
--- /dev/null
+++ b/lib/std/hasprefix.myr
@@ -0,0 +1,12 @@
+use "cmp.use"
+pkg std =
+ const hasprefix : (s : byte[:], pre : byte[:] -> bool)
+;;
+
+const hasprefix = {s, pre
+ match strncmp(s, pre, pre.len)
+ | `Equal: -> true
+ | _: -> false
+ ;;
+}
+