Case insensitive String startsWith, contains, endsWith, replaceAll method
Biju
bijumaillist at gmail.com
Mon Feb 18 05:48:20 PST 2013
On 18 February 2013 01:24, Norbert Lindenberg
<ecmascript at lindenbergsoftware.com> wrote:
> Actually, it's not just case that users want to ignore. In many use cases, users search for something "similar" to their search string, and the definition of "similar" can vary substantially. For example, an English speaker typically wants "San Jose" to also match "San José", especially when he doesn't know how to type accented characters. For a French speaker, on the other hand, "ne" and "né" are distinct words. Japanese speakers sometimes want to treat all of "あ", "ぁ", "ア", "ア", and "ァ" as similar, or even better, have "たなか" match "田中" based on pronunciation. And in pretty much all cases you want to apply Unicode normalization.
Biju: I could accept that argumnet
>
> For use cases where you want to select a subset of a list of strings based on similarity, Collator objects from the ECMAScript Internationalization API can be used, with the usage option set to "search". But for the use cases you're primarily concerned about, new API will be needed. Since this is all language and context sensitive, the ECMAScript Language Specification is probably not the right place to define this API.
Biju: Then let me redefine my request. Instead of "Ignore case", match
text by what ever satisfying "i" flag for RegExp defined in ECMA
script/the browser/user agent. Dont tell me now there is nothing
defined for "i" flag.
Also nothing above is stopping standardization of mozilla non-standard
flags parameter for String.replace as standard.
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/replace#Syntax
Cheers
Biju
More information about the es-discuss
mailing list