Mercurial > urweb
changeset 1793:446e73902b09
Fix JavaScript implementation of strcspn()
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Tue, 24 Jul 2012 19:49:50 -0400 |
parents | 3d823d8424cc |
children | 4671afac15af |
files | lib/js/urweb.js tests/strcspn.ur |
diffstat | 2 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/js/urweb.js Mon Jul 23 09:03:41 2012 -0400 +++ b/lib/js/urweb.js Tue Jul 24 19:49:50 2012 -0400 @@ -1104,7 +1104,7 @@ if (chs.indexOf(s.charAt(i)) != -1) return i; - return null; + return s.length; } function schr(s, ch) { var r = s.indexOf(ch);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/strcspn.ur Tue Jul 24 19:49:50 2012 -0400 @@ -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>