Optionally ignoring case in String.prototype.contains()?

Norbert Lindenberg ecmascript at lindenbergsoftware.com
Wed Aug 28 10:45:08 PDT 2013


$ 'Hallo Friedrichstraße'.contains('STRASSE', { ignoreCase: true })
true? false?

$ 'hello İzmir'.contains('İZMİR', { ignoreCase: true })
true? false?

In other words, should ignoreCase be based on Unicode upper case conversion, lower case conversion, or case folding, with or without locale dependent rules? I suspect any choice would surprise some people.

Norbert


On Aug 28, 2013, at 8:19 , Axel Rauschmayer <axel at rauschma.de> wrote:

> Suggestion: a named parameter `ignoreCase`:
> 
>     $ 'hello world'.contains('WORLD')
>     false
> 
>     $ 'hello world'.contains('WORLD', { ignoreCase: true })
>     true
> 
> -- 
> Dr. Axel Rauschmayer
> axel at rauschma.de
> 
> home: rauschma.de
> twitter: twitter.com/rauschma
> blog: 2ality.com
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list