Removing a character at a specified position

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
substr() based
x = "Hello world"
i = 3;
chr = "";
x.substr(0, i) + chr + x.substr(i + 1);
ready
substring() based
x = "Hello world"
i = 3;
chr = "";
x.substring(0, i - 1) + x.substring(i, x.length);
ready
slice() based
x = "Hello world"
i = 3;
chr = "";
x.slice(0, i) + x.slice(i+1);
ready
simple substring() based
x = "Hello world"
i = 3;
chr = "";
x.substring(0, i) + 'h' + x.substring(i+1);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.