summaryrefslogtreecommitdiff
path: root/lib/js
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-05-30 13:29:00 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-05-30 13:29:00 -0400
commit54276f5a38163eb7997c574810faed0cc6dea35c (patch)
treeff01535ec8b49034e5cb39f0be1e36261bea9d8b /lib/js
parent581a2290590268039cacfbe0762b343f710c3116 (diff)
Substring functions; fix a nasty MonoReduce pattern match substitution bug
Diffstat (limited to 'lib/js')
-rw-r--r--lib/js/urweb.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index db3c934c..be3d652a 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -353,6 +353,23 @@ function bs(b) { return (b ? "True" : "False") }
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);