On Wed, Oct 8, 2025 at 9:06 PM Zeeshan Abid <[email protected]> wrote:
>
> Hello, I noticed that `toLower() === toLower()` is the common practice for 
> comparing strings ignoring case sensitivity. I wanted to know is it possible 
> to add a function like
>
> `String.compare(str1, str2, IgnoreLowerCaseOption);`
>
> This should in theory run faster than doing `toLower() === toLower()`
>
> I already tried using `String.prototype.localeCompare` and it is slower than 
> doing `toLower() === toLower()`
>
> Thanks!

The answer to your question is both yes and no.

Yes, in that it would be possible to implement that method in V8.

No, in that V8 won't implement it until it's part of the ECMA
specification. Getting changes to the spec accepted means going
through TC39. I'd rather visit my local dentist; it's less painful and
over quicker.

String.prototype.localeCompare computes equivalence, which is much
more complex and complicated than the case conversion that
String.prototype.toLowerCase performs. For example, localeCompare
considers "s\u0307\u0323" and "\u1E69" equivalent, whereas toLowerCase
does not.

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/v8-dev/CAHQurc9P%3DLOMK_tjtegGzdE5iTbmi2szuO7yNc3mDwqirBwvog%40mail.gmail.com.

Reply via email to