Mercurial > urweb
diff lib/ur/string.ur @ 1174:9df124fcab3d
String.isPrefix
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 02 Mar 2010 09:46:17 -0500 |
parents | 94e83c5533d2 |
children | 56bd4a4f6e66 |
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