In most time when user want to search something in a text, he/she
wants to do a case insensitive search.
For example to filter items displayed in list on a page.
Also on other applications, say any word processor, or in page search
in Firefox, IE, Chrome etc.

So can we make the default behavior of new methods String.startsWith,
String.contains, String.endsWith case insensitive?

And to make it case sensitive we should add a third flag parameter matchCase
like...

var startsWith = str.startsWith(searchString [, position [, matchCase] ] );
var contained = str.contains(searchString [, position [, matchCase] ] );
var endsWith = str.endsWith(searchString [, position [, matchCase] ] );


Additionally we should have a String.replaceAll method right now web
developers are using complex logic to achieve the same.
(Again with insensitive search by default.)
String.replace is not helping, as it default to case sensitive and a
one time operation, if the first parameter is not a regular
expression.

We could also add String.replaceFirst and String.replaceLast method.

If we dont want change behavior of String.startsWith, String.contains,
String.endsWith to case insensitive.
Can we have another set methods probably named
String.startsWithI, String.containsI, String.endsWithI
(where "I" stands for ignore/insensitive case)

Cheers
Biju


http://wiki.ecmascript.org/doku.php?id=harmony:string_extras
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to