tenfourfox icon indicating copy to clipboard operation
tenfourfox copied to clipboard

Implement String.prototype.replaceAll

Open classilla opened this issue 3 years ago • 1 comments

This actually could be useful for some of the other work we're doing. A simple-minded version would take str_replace in jsstr.cpp and make one that loops around. It should check that if it got a RegExp, that the global flag were set. This wouldn't be super fast but it would be a working first pass.

https://bugzilla.mozilla.org/show_bug.cgi?id=1540021 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll

classilla avatar Mar 07 '21 04:03 classilla

js::str_flat_replace_string will replace all occurrences. We can just use that.

classilla avatar Mar 26 '21 00:03 classilla