changeset 1624:f96e708b4b93

Client-side strlenGe
author Adam Chlipala <adam@chlipala.net>
date Sat, 03 Dec 2011 16:05:06 -0500 (2011-12-03)
parents 218e2a9a53d0
children bd34a4af516a
files lib/js/urweb.js src/settings.sml tests/lengthGe.ur
diffstat 3 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lib/js/urweb.js	Sat Dec 03 15:59:21 2011 -0500
+++ b/lib/js/urweb.js	Sat Dec 03 16:05:06 2011 -0500
@@ -943,6 +943,9 @@
 function ssub(s, start, len) {
     return s.substring(start, start+len);
 }
+function strlenGe(s, len) {
+    return s.length >= len;
+}
 
 function trimZeroes(s) {
     for (var i = 0; i < s.length; ++i)
--- a/src/settings.sml	Sat Dec 03 15:59:21 2011 -0500
+++ b/src/settings.sml	Sat Dec 03 16:05:06 2011 -0500
@@ -248,6 +248,7 @@
                           ("strchr", "schr"),
                           ("substring", "ssub"),
                           ("strcspn", "sspn"),
+                          ("strlenGe", "strlenGe"),
                           ("kc", "kc"),
                           ("minTime", "0"),
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lengthGe.ur	Sat Dec 03 16:05:06 2011 -0500
@@ -0,0 +1,7 @@
+fun main () : transaction page =
+    s <- source "";
+    return <xml><body>
+      <ctextbox source={s}/>
+      <dyn signal={v <- signal s;
+                   return (txt (strlenGe v 3))}/>
+    </body></xml>