summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/js/urweb.js3
-rw-r--r--src/settings.sml1
-rw-r--r--tests/lengthGe.ur7
3 files changed, 11 insertions, 0 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index c5bb58f7..854ebe45 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -943,6 +943,9 @@ function schr(s, ch) {
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)
diff --git a/src/settings.sml b/src/settings.sml
index 23860b31..d66b33ef 100644
--- a/src/settings.sml
+++ b/src/settings.sml
@@ -248,6 +248,7 @@ val jsFuncsBase = basisM [("alert", "alert"),
("strchr", "schr"),
("substring", "ssub"),
("strcspn", "sspn"),
+ ("strlenGe", "strlenGe"),
("kc", "kc"),
("minTime", "0"),
diff --git a/tests/lengthGe.ur b/tests/lengthGe.ur
new file mode 100644
index 00000000..2991ad87
--- /dev/null
+++ b/tests/lengthGe.ur
@@ -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>