String.indexOf/lastIndexOf methods need toIndex parameter

RESOLVED WONTFIX

Status

()

RESOLVED WONTFIX
9 years ago
7 years ago

People

(Reporter: mnyromyr, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

9 years ago
String.indexOf/lastIndexOf do take a second parameter to specify where to start searching, but none for where to stop. This is rather inefficient for long strings, because you need to either cut the string before searching or you waste time searching in "uninteresting" string portions.

I propose defining an additional toIndex:
  String.indexOf(searchValue[, fromIndex[, toIndex]]) 
  String.lastIndexOf(searchValue[, fromIndex[, toIndex]])
(Reporter)

Updated

9 years ago
Summary: String.indexOf/lastIndexOf methods needs endIndex parameter → String.indexOf/lastIndexOf methods need toIndex parameter
I suggest proposing this to es-discuss:

https://mail.mozilla.org/listinfo/es-discuss
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → WONTFIX
(Reporter)

Comment 2

7 years ago
Tom, care to elaborate?
We implement what ECMA specifies, so before we'll implement it, ECMA has to support it.  Hence comment 1.
You need to log in before you can comment on or make changes to this bug.