diff options
author | 2009-05-30 13:29:00 -0400 | |
---|---|---|
committer | 2009-05-30 13:29:00 -0400 | |
commit | 54276f5a38163eb7997c574810faed0cc6dea35c (patch) | |
tree | ff01535ec8b49034e5cb39f0be1e36261bea9d8b /lib/js/urweb.js | |
parent | 581a2290590268039cacfbe0762b343f710c3116 (diff) |
Substring functions; fix a nasty MonoReduce pattern match substitution bug
Diffstat (limited to 'lib/js/urweb.js')
-rw-r--r-- | lib/js/urweb.js | 17 |
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); |