Mercurial > urweb
diff lib/js/urweb.js @ 829:20fe00fd81da
Substring functions; fix a nasty MonoReduce pattern match substitution bug
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 30 May 2009 13:29:00 -0400 |
parents | 14a6c0971d89 |
children | 5e1a4b12c83a |
line wrap: on
line diff
--- a/lib/js/urweb.js Sat May 30 09:59:10 2009 -0400 +++ b/lib/js/urweb.js Sat May 30 13:29:00 2009 -0400 @@ -353,6 +353,23 @@ function sub(s, i) { return s[i]; } function suf(s, i) { return s.substring(i); } function slen(s) { return s.length; } +function sidx(s, ch) { + var r = s.indexOf(ch); + if (r == -1) + return null; + else + return r; +} +function schr(s, ch) { + var r = s.indexOf(ch); + if (r == -1) + return null; + else + return s.substring(r); +} +function ssub(s, start, len) { + return s.substring(start, start+len); +} function pi(s) { var r = parseInt(s);