summaryrefslogtreecommitdiff
path: root/lib/ur/string.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2010-03-02 09:46:17 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2010-03-02 09:46:17 -0500
commit3d3128f92dc9a540b0b4f915fcef0e545486d660 (patch)
tree60d0f41d2caabe574b702400d67f278f47673f8a /lib/ur/string.ur
parent5bfa75dbe0910dd19a8e0f40e2d03e33a4c44eb8 (diff)
String.isPrefix
Diffstat (limited to 'lib/ur/string.ur')
-rw-r--r--lib/ur/string.ur3
1 files changed, 3 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