[Proposal] ignoreCase method
Isiah Meadows
isiahmeadows at gmail.com
Thu Jun 28 02:19:00 UTC 2018
I would be a fan of adding a `string.compare(other, {ignoreCase = false,
unicode = false})` that purely works by character code/code point and is
required to return 1, 0, or -1. That would be easier to spec, and is more
generally useful when you're working with strings for computers, not people.
But that's largely independent of this proposal.
-----
Isiah Meadows
me at isiahmeadows.com
www.isiahmeadows.com
On Wed, Jun 27, 2018 at 11:37 AM, Robert Wozniak <wozniakj.robert at gmail.com>
wrote:
> Hi,
>
>
>
> I think you’re right, It could be simpler to do it like that.
>
>
>
> I have checked “localeCompare”, it does compare case sensitive strings but
> it doesn’t compare strings in an array and to do it, you will have to
> execute the method as many times as strings in an array. By using
> ignoreCase method, you will pass specific array and the method will do it
> for you inside. Second thing, “localeCompare” returns numbers: 0, 1, -1, -2
> depends on the result, a method proposed by me returns true or false.
>
>
>
> Another thing would be that “localeCompare” is heavier that ignoreCase
> method. I think we should have lightweight alternative to compare case
> sensitive strings.
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180627/05d07ed8/attachment.html>
More information about the es-discuss
mailing list