# More sort comparison functions

**URL:** <https://es.discourse.group/t/more-sort-comparison-functions/459>\
**Category:** 💡 Ideas\
**Tags:** proposal\
**Created:** [September 7, 2020, 9:42am UTC](https://es.discourse.group/t/more-sort-comparison-functions/459 "2020-09-07T09:42:41Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![claudiameadows](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/claudiameadows/32/126_2.png) [@claudiameadows](https://es.discourse.group/u/claudiameadows)\
**Post date:** [September 15, 2020, 7:31am UTC](https://es.discourse.group/t/more-sort-comparison-functions/459/4 "2020-09-15T07:31:24Z")

</div>

And to add onto that, `strings.sort((a, b) => a.localeCompare(b))` is equivalent to `strings.sort(new Intl.Collator().compare)`, just slightly less efficient.

Case-insensitive comparisons can't really be done in a language-independent manner, and my `String.compare` is just lexicographic and based on character code order. It's not actually useful for language in general, and as `.sort` does that by default, it's not useful there. However, it's useful for things like binary search of a sorted list of strings or other similar low-level locale-independent string tasks.

---

_[View the full topic](https://es.discourse.group/t/more-sort-comparison-functions/459)._
