Closed Bug 524912 Opened 15 years ago Closed 13 years ago

String.indexOf/lastIndexOf methods need toIndex parameter

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: mnyromyr, Unassigned)

Details

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]])
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
Closed: 13 years ago
Resolution: --- → WONTFIX
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.