diff --git a/src/StringPrototype.js b/src/StringPrototype.js new file mode 100644 index 00000000..851d4953 --- /dev/null +++ b/src/StringPrototype.js @@ -0,0 +1,18 @@ +if (String.prototype.replaceAll === undefined) { + String.prototype.replaceAll = function (before, after) { + let res = new String(), matched = 0; + for (let i = 0; i < this.length; i += 1) { + if (this[i] == before[matched]) { + matched += 1; + if (matched == before.length) { + res += after; + matched = 0; + } + } else { + matched = 0; + res += this[i]; + } + } + return res; + }; +} \ No newline at end of file diff --git a/src/components/problem/content.vue b/src/components/problem/content.vue index 715ad368..3cfa6a96 100644 --- a/src/components/problem/content.vue +++ b/src/components/problem/content.vue @@ -1,7 +1,7 @@