summaryrefslogtreecommitdiff
path: root/lib/std/hassuffix.myr
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std/hassuffix.myr')
-rw-r--r--lib/std/hassuffix.myr15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/std/hassuffix.myr b/lib/std/hassuffix.myr
new file mode 100644
index 0000000..87369af
--- /dev/null
+++ b/lib/std/hassuffix.myr
@@ -0,0 +1,15 @@
+use "sleq.use"
+pkg std =
+ const hassuffix : (s : byte[:], suff : byte[:] -> bool)
+;;
+
+const hassuffix = {s, suff
+ var tail
+
+ if suff.len <= s.len
+ tail = s[s.len - suff.len:]
+ -> sleq(tail, suff)
+ ;;
+ -> false
+}
+