summaryrefslogtreecommitdiff
path: root/lib/ur
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ur')
-rw-r--r--lib/ur/string.ur3
-rw-r--r--lib/ur/string.urs2
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/ur/string.ur b/lib/ur/string.ur
index 07d7e6b8..f19ce174 100644
--- a/lib/ur/string.ur
+++ b/lib/ur/string.ur
@@ -53,3 +53,6 @@ fun newlines [ctx] [[Body] ~ ctx] s : xml ([Body] ++ ctx) [] [] =
case split s #"\n" of
None => cdata s
| Some (s1, s2) => <xml>{[s1]}<br/>{newlines s2}</xml>
+
+fun isPrefix {Full = f, Prefix = p} =
+ length f >= length p && substring f {Start = 0, Len = length p} = p
diff --git a/lib/ur/string.urs b/lib/ur/string.urs
index 557e73c0..552da557 100644
--- a/lib/ur/string.urs
+++ b/lib/ur/string.urs
@@ -23,3 +23,5 @@ val all : (char -> bool) -> string -> bool
val mp : (char -> char) -> string -> string
val newlines : ctx ::: {Unit} -> [[Body] ~ ctx] => string -> xml ([Body] ++ ctx) [] []
+
+val isPrefix : {Full : t, Prefix : t} -> bool