Mercurial > urweb
changeset 1174:9df124fcab3d
String.isPrefix
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 02 Mar 2010 09:46:17 -0500 |
parents | 983d9b38abc7 |
children | 79f487f51d9f |
files | lib/ur/string.ur lib/ur/string.urs |
diffstat | 2 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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) => <xml>{[s1]}<br/>{newlines s2}</xml> + +fun isPrefix {Full = f, Prefix = p} = + length f >= length p && substring f {Start = 0, Len = length p} = p
--- 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