summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/js/urweb.js2
-rw-r--r--tests/strcspn.ur6
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 4435bffa..56066d26 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -1104,7 +1104,7 @@ function sspn(s, chs) {
if (chs.indexOf(s.charAt(i)) != -1)
return i;
- return null;
+ return s.length;
}
function schr(s, ch) {
var r = s.indexOf(ch);
diff --git a/tests/strcspn.ur b/tests/strcspn.ur
new file mode 100644
index 00000000..8066010b
--- /dev/null
+++ b/tests/strcspn.ur
@@ -0,0 +1,6 @@
+fun main () : transaction page =
+ s <- source "";
+ return <xml><body>
+ <ctextbox source={s}/>
+ <button onclick={fn _ => v <- get s; alert (show (strcspn v "0123456789"))}/>
+ </body></xml>