summaryrefslogtreecommitdiff
path: root/lib/js
diff options
context:
space:
mode:
authorGravatar fab <fabrice.leal.ch@gmail.com>2018-12-06 22:24:13 +0000
committerGravatar fab <fabrice.leal.ch@gmail.com>2018-12-06 22:24:13 +0000
commit3795cd7e0182bd0845024373a31f97ee200597da (patch)
tree2980987a13a26bed52405b455af02bed6de891d6 /lib/js
parent8e998f7d96d3236e182ea54cc077f87538651af3 (diff)
strsub, strcspn, strsindex
Diffstat (limited to 'lib/js')
-rw-r--r--lib/js/urweb.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 18d47847..f41d7240 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -1498,11 +1498,14 @@ function ssidx(h, n) {
}
function sspn(s, chs) {
- for (var i = 0; i < s.length; ++i)
- if (chs.indexOf(s.charAt(i)) != -1)
+ var s2 = Array.from(s);
+ var chs2 = Array.from(chs);
+
+ for (var i = 0; i < s2.length; ++i)
+ if (chs2.indexOf(s2[i]) != -1)
return i;
- return s.length;
+ return s2.length;
}
function schr(s, ch) {
var r = s.indexOf(ch);