# HG changeset patch # User Adam Chlipala # Date 1267541177 18000 # Node ID 9df124fcab3d050df25ae46393a0f730e6a5a3eb # Parent 983d9b38abc74db895994febbdee18d4d061ef7f String.isPrefix diff -r 983d9b38abc7 -r 9df124fcab3d lib/ur/string.ur --- a/lib/ur/string.ur Sun Feb 28 15:46:41 2010 -0500 +++ b/lib/ur/string.ur Tue Mar 02 09:46:17 2010 -0500 @@ -53,3 +53,6 @@ case split s #"\n" of None => cdata s | Some (s1, s2) => {[s1]}
{newlines s2}
+ +fun isPrefix {Full = f, Prefix = p} = + length f >= length p && substring f {Start = 0, Len = length p} = p diff -r 983d9b38abc7 -r 9df124fcab3d lib/ur/string.urs --- a/lib/ur/string.urs Sun Feb 28 15:46:41 2010 -0500 +++ b/lib/ur/string.urs Tue Mar 02 09:46:17 2010 -0500 @@ -23,3 +23,5 @@ val mp : (char -> char) -> string -> string val newlines : ctx ::: {Unit} -> [[Body] ~ ctx] => string -> xml ([Body] ++ ctx) [] [] + +val isPrefix : {Full : t, Prefix : t} -> bool