From 08bbe52588b9d195295f1b5aca14c88a9ae3ea3c Mon Sep 17 00:00:00 2001 From: Samuel Dukhovni Date: Mon, 28 Jul 2014 20:18:43 -0400 Subject: Added javascript for Basis.strsindex --- lib/js/urweb.js | 7 +++++++ src/settings.sml | 1 + 2 files changed, 8 insertions(+) diff --git a/lib/js/urweb.js b/lib/js/urweb.js index c3cab50a..76a900f7 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -1212,6 +1212,13 @@ function sidx(s, ch) { else return r; } +function ssidx(h, n) { + var r = h.indexOf(n); + if (r == -1) + return null; + else + return r; +} function sspn(s, chs) { for (var i = 0; i < s.length; ++i) if (chs.indexOf(s.charAt(i)) != -1) diff --git a/src/settings.sml b/src/settings.sml index ec05d84d..ff3ab83a 100644 --- a/src/settings.sml +++ b/src/settings.sml @@ -289,6 +289,7 @@ val jsFuncsBase = basisM [("alert", "alert"), ("strsuffix", "suf"), ("strlen", "slen"), ("strindex", "sidx"), + ("strsindex", "ssidx"), ("strchr", "schr"), ("substring", "ssub"), ("strcspn", "sspn"), -- cgit v1.2.3